立即重新加载Chrome浏览器开发工具网络预览无法正常工作

时间:2020-08-12 10:19:02

标签: javascript google-chrome

当我获取内容并立即重新加载页面时,网络预览将加载失败。
如果我将超时设置为1000ms,有时成功有时失败;
如果我将超时设置为3000毫秒,它将始终有效。

我猜错误是在读取数据时被刷新页面中断的。
因此,我可以捕获“信号”吗?呃,我的意思是“预览已加载信号”。

我已经启用了“保留日志”。

对比度

enter image description here

代码

document.body.insertAdjacentHTML("afterbegin","<button>SEND</button>");

document.querySelector("button").onclick = () =>{
    fetch("https://cors-anywhere.herokuapp.com/https://stackoverflow.com/").then(
    r => r.text()
  ).then(
    r => {
        console.log(r.split("\n")[0]);
      location.reload();  // Failed
      // setTimeout(()=>{location.reload();}, 3000);  // Success
    }
  )
}

样本

JSFiddle


环境

  • Chrome:版本83.0.4103.97(官方内部版本)(64位)

0 个答案:

没有答案