如何查看网页性能
window.performance.getEntries();
此方法返回网站所有静态资源(脚本、图片、样式等)的http请求时间数组 。
示例:
var result = [];
window.performance.getEntries().forEach(function (item) {
result.push({
'url': item.name,
'entryType': item.entryType,
'duration(ms)': item.duration
});
});
console.log(result);

浙公网安备 33010602011771号