自chrome v73.0.3683.86起,我就遇到了javascript问题,每当我在window.location.reload()函数之后运行我的javascript代码时,它总是给我错误“ Unchecked runtime.lastError:消息端口在收到答复。”
我在互联网上搜索了许多主题,但其中大多数是关于chrome扩展的。因此,我尝试在认知模式下运行此代码并禁用所有扩展名,但没有任何更改。
※由于某种原因,我需要在window.location.reload()之后运行一些东西
像这样的onClick javascript函数
<html>
<head>
<title>Hello world!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
function buttonClick() {
window.location.reload();
document.title = "Hi there";
}
</script>
</head>
<body>
<div>TODO write content</div>
<button onclick="buttonClick()">Click here</button>
</body>
</html>
您可以尝试在没有任何扩展程序的chrome上运行它吗?-右键点击您的Chrome快捷方式-选择属性。-在目标字段的末尾添加--disable-extensions --disable-plugins
它看起来像:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" /high-dpi-support=1 /force-device-scale-factor=1 --disable-extensions --disable-plugins
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句