在此链接中,介绍了如何使用网络计时面板/窗口。但是,我发现计时是相对的:这里没有“精确时间”。例如,我想查看ajax开始和结束的确切时间。这应该是我需要在此面板中查看的字符串,作为ajax请求的“精确开始时间”(链接)。
在Chrome开发者工具中,如何实现这一点?是否有任何地方记录了网络事件的确切日期时间?
在Chrome开发者工具中,如何实现这一点?是否有任何地方记录了网络事件的确切日期时间?
我进入了控制台并进行了XMLHttpRequest的猴子补丁,如下所示:
const original = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function( ) {
console.log(new Date().toISOString(), arguments);
return original.apply(this, [].slice.call(arguments));
};
对我有效。
2022-11-17T19:20:26.013Z Arguments(3) ['POST', 'http://localhost:7450/realms/CLIENTID/protocol/openid-connect/token', true, callee: ƒ, Symbol(Symbol.iterator): ƒ]
2022-11-17T19:21:26.286Z Arguments(3) ['POST', 'http://localhost:7450/realms/CLIENTID/protocol/openid-connect/token', true, callee: ƒ, Symbol(Symbol.iterator): ƒ]
我认为如果需要的话,也可以对fetch
进行猴子补丁。