window.onresize在Chrome中未触发,但在Chrome隐身模式下触发 [英] window.onresize not firing in Chrome but firing in Chrome Incognito

查看:425
本文介绍了window.onresize在Chrome中未触发,但在Chrome隐身模式下触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问在甚么情况下甚至可以这样做?我有一个带有 window.onresize 事件的网站,适用于Firefox,IE9,Chrome隐身窗口,但不适用于Chrome。
事情是,它在我对代码做了一些无关的修改之前,或者在我昨天更新了chrome之前就已经工作了(不知道)。



在firefox和chrome中没有报告javascript控制台错误。



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



有没有可能我错过了某个地方,奇迹般地让代码在除chrome之外的任何地方都能正常工作,并且不会显示任何错误? Chrome和Chrome隐身模式之间的区别是什么?



对于这个晦涩难懂的问题感到抱歉,但是真的,这就是我所拥有的,并且我花了一些时间在这个上...



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



但这是一个问题,我可以'不要期望人们关闭他们的分机来查看我的网站。为什么它会干扰我的代码?

解决方案

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



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



换句话说,隐身Chrome浏览器和常规Chrome是否隐身模式具有不同的缓存和设置,并且默认情况下可能不会使用扩展名。所以如果他们之间存在问题,这很可能是这些功能中的一个问题。



编辑:感谢Darhazer,这可能也是一个小结果的干扰插件。如果上述不起作用,请尝试转到窗口 - >扩展程序并禁用扩展程序以查看是否可能导致此问题。


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?

解决方案

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.

这篇关于window.onresize在Chrome中未触发,但在Chrome隐身模式下触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆