在Internet Explorer 7和8中,但不是9和更新版本,单击包含网站上图像的div会触发window.blur事件。 但这是错误的。
但是,这非常失效,因为我们使用此方法来确定用户是否离开了网站(焦点在另一个窗口)。
有关如何解决此问题的任何想法?
In Internet Explorer 7 and 8, but not in 9 and newer, clicking on a div which contains an image on a website, triggers the window.blur event. But this is wrong.
However, this is very disfunctional, because we use this method to find out if the user leaves the website (focus is on another window).
Any idea on how to workaround this problem?
最满意答案
我通过在window.blur回调中检查document.hasFocus()作为第一件事来解决了这个问题。 如果它被错误地触发,至少文档仍然具有焦点。
问题可能是由于使用HTML 5标签,如article和section混淆旧IE。
I solved the problem by checking document.hasFocus() as a first thing in the window.blur callback. If it gets triggered wrongly, at least the document does still has focus.
The problem was probably due to using HTML 5 tags such as article and section which confused the old IEs.
更多推荐
window,网站,website,blur,div,电脑培训,计算机培训,IT培训"/> <meta name="de
发布评论