首页 > 解决方案 > 加载页面而不从 devtools 中刷新窗口对象

问题描述

我想从 devtools 中加载一个具有以下特征的页面

const x = 10;
window.location = "http://google.com";
// wait for the page to load
console.log(x); // undefined :( I want to see '10' here!!

我也试过

history.replaceState(null,null, 'https://google.com')

但这给出了一个错误

在此处输入图像描述

如果有 chrome 设置允许这样做,那对我也有用!

有什么建议么?

标签: javascripthtmlgoogle-chromegoogle-chrome-devtools

解决方案


推荐阅读