单击链接时 IE 会随机最小化
我有一个奇怪的问题。当我单击 IE7 中的链接时,窗口最小化。它似乎只是页面上链接的子集。它也不会始终在相同的链接上发生,并且因计算机而异。
链接文本示例:加拿大立法 ;
有人以前见过这个或者知道可能是什么原因造成的吗?
I have the bizarre problem. When I click on a link in IE7 the window minimizes. It seems to only be a subset of the links on the page. It also doesn't consistently happen with the same link and differs from computer to computer.
example link text:<a hidefocus="on" href="#" tabindex="1"><span unselectable="on" id="extdd-102">Canadian Legislation</span></a>
Anyone seen this before or have any idea what might be causing it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
终于想通了。实际上,一个自定义 JavaScript 点击处理程序导致了该问题。
我的点击处理程序正在对当前活动元素调用
activeElement.blur();
(以便在元素被销毁时触发与模糊相关的事件)。问题在于 IE 中,如果您对任何不是输入的内容调用模糊,它会最小化窗口。
Finally figured it out. It was actually a custom JavaScript click handler that caused the problem.
My click handler was calling
activeElement.blur();
on the current active element (so that events tied to blur fired when the elements were destroyed).Problem is in IE, if you call blur on anything that isn't an INPUT, it minimizes the window.
我在 Internet Explorer 10 上遇到了同样的问题。Internet
仅当您在 document.body 元素上调用 Blur() 函数时才会发生此问题。
只需执行即可重现问题
in your browser console.
document.activeElement.blur() 函数调用是发生此问题的最常见场景,因为首次调用 document.activeElement.blur() 后,body 元素将成为 activeElement 并随后调用document.activeElement.blur() 将在 body 元素上调用模糊。
避免调用 document.body.blur() 函数,如果你有 jquery,你可以引入这个简单的逻辑
来检查你的对象是否是 body 元素,以避免对其调用 Blur() 函数
I had the same issue on Internet Explorer 10.
This issue only happen when you invoke the blur() function on document.body element.
Issue can be reproduced simply executing
in your browser console.
document.activeElement.blur() function invocation is the most common scenario in which this issue occurs because after first invocation of document.activeElement.blur() the body element will become the activeElement and subsequent call to document.activeElement.blur() will invoke blur on body element.
avoid document.body.blur() function invocation, if you have jquery you can introduce this simple logic
to check if your object is the body element, in order to avoid blur() function invocation on it
IE 有问题,因此您可以通过删除“tabindex”来排除故障。如果这不起作用,请尝试删除“unelecable”,然后删除“hideonfocus”。 “Hideonfocus”听起来很奇怪。先尝试删除它。您有与 IE 交互的第三方程序或插件吗?它可以在不同的计算机上运行吗?
IE is buggy, so you can troubleshoot by removing "tabindex". If that doesn't work try removing "unelectable" then "hideonfocus". "Hideonfocus" sounds weird. Try removing that first. Do you have any third party programs or plugins that interact with IE? Does it work on a different computer?
当我使用模糊解决方法让占位符属性在 IE8 上工作时,就会发生这种情况。
在解决方法中,我应该调用blur(),这会导致浏览器模糊(最小化到托盘)。
解决方案是使用:
这只是具体说明什么是模糊。
完整的占位符解决方法是:
This happened when I used the blur workaround to get the placeholder attribute to work on IE8.
In the workaround I should call blur() which caused the browser to blur (minimize to tray).
The solution is to use:
which is only being specific what to call blur on.
The complete placeholder workaround is: