2017-06-27 44 views

回答

0

您可以通過JavaScript獲得這些值的列表:

window.performance.getEntries().filter(e=>e.initiatorType==='xmlhttprequest'); 

以上性能的條目返回數組的功能。查看示例以打印下面的值。

<script type="text/javascript">window.performance.getEntries().filter(e=>e.initiatorType==='xmlhttprequest').forEach(entry=>document.write(JSON.stringify(entry) + '<br/>'));</script> 

或者,你可以從陣列中的條目:

var entry = performance.getEntries().filter(e=>e.initiatorType==='xmlhttprequest')[0]; 
var name = entry.name; 
var startTime = entry.startTime; 
var duration = entry.duration; 

你可以得到其他類型,比如「導航」的條目。參見performanceEntryType

相關問題