Вопрос

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?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top