window.onresize not firing in Chrome but firing in Chrome Incognito

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

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?

回答1:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!