window.onresize 不在 Chrome 中触发,但在 Chrome Incognito 中触发

发布于 2024-12-14 02:02:38 字数 746 浏览 1 评论 0原文

我想问一下,在什么情况下可以这样呢?我有一个带有 window.onresize 事件的网站,适用于 Firefox、IE9、Chrome 隐身窗口,但不适用于 Chrome。 问题是,在我对代码进行一些不相关的更改之前,或者在我昨天更新 chrome 之前(?不能告诉),它曾经可以工作。

Firefox 和 Chrome 中均未报告 JavaScript 控制台错误。

即使是最基本的东西也不起作用 window.onresize = t;函数 t (e) {alert("wtf?");}

我是否有可能在某个地方错过了一些 } ,神奇地使代码仍然可以在除 chrome 之外的任何地方工作并且不会显示任何错误? chrome 和 chrome incognito 之间的 JavaScript 区别是什么?

很抱歉这个晦涩的问题,但实际上,这就是我所拥有的一切,我已经花了一些时间在这上面......

[编辑] 这是 ScreenCapture 的错,谷歌扩展: https://chrome.google.com/webstore/detail/cpngackimfmofbokmjmljamhdncknpmg

但这是一个问题,我不能指望人们关闭他们的扩展程序来查看我的网站。为什么它会这样干扰我的代码?

I would like to ask in what situations could this even be possible? I've got a website with a window.onresize event, works in firefox, IE9, Chrome Incognito windows, but not in Chrome.
The thing is, it used to work before I made some unrelated changes to my code, or before I updated chrome yesterday (? can't tell).

No javascript console errors are reported in firefox nor in chrome.

Not even the most basic thing works window.onresize = t; function t (e) { alert("wtf?");}.

Is it possible that I've missed some } somewhere that magically makes the code still work everywhere except in chrome and without showing any errors? What's the javascript difference between chrome and chrome incognito?

Sorry for the obscure question, but really, that's all I've got, and I've spent some time on this...

[EDIT] It was ScreenCapture's fault, a google extension: https://chrome.google.com/webstore/detail/cpngackimfmofbokmjmljamhdncknpmg

But this is a problem, I can't expect people to turn off their extensions to view my website. Why is it interfering with my code like that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘你却要生生世世 2024-12-21 02:02:38

清除缓存。在 Mac 版 Chrome 中,这是 Chrome ->清除浏览数据->清空缓存

最有可能的是,缓存中的某些文件丢失、过时或损坏,这就是为什么它可以在隐身模式下运行,但不能在正常的 Chrome 窗口中运行。清除缓存,如果不起作用,请确保 Chrome 已更新到最新版本。

换句话说,“隐身 Chrome”和“常规 Chrome”之间的区别在于隐身模式具有不同的缓存、设置,并且默认情况下可能不使用扩展程序。因此,如果它们之间存在问题,很可能是这些功能之一存在问题。

编辑:谢谢 Darhazer,它也有可能是干扰插件的结果。如果上述方法不起作用,请尝试转到 Window ->扩展并禁用扩展以查看是否可能导致问题。

Clear your cache. In Chrome for Mac, that's Chrome -> Clear Browsing Data -> Empty the Cache.

Most likely, some file in your cache is missing, outdated, or corrupted, which is why it would work in Incognito mode, but not in a normal Chrome window. Clear your cache, and if that doesn't work, make sure Chrome is updated to the latest version.

In other words, the differences between "Incognito Chrome" and "Regular Chrome" are that Incognito mode has different caches, settings, and may not use extensions by default. So if there's a problem between them, it's most likely an issue with one of those features.

Edit: Thanks Darhazer, there's a small possibility that it could also be the result of an interfering plugin. If the above doesn't work, try going to Window -> Extensions and disabling extensions to see if that might be causing the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文