IE is randomly minimizing when a link is clicked

后端 未结 4 1150
时光取名叫无心
时光取名叫无心 2021-01-12 05:18

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 w

4条回答
  •  粉色の甜心
    2021-01-12 05:48

    I had the same issue on Internet Explorer 10.

    • Internet Explorer 10 tested behaviour:

    This issue only happen when you invoke the blur() function on document.body element.

    Issue can be reproduced simply executing

     document.body.blur() 
    in your browser console.

    • Common scenario in which this issue happens:

    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.

    • Solution:

    avoid document.body.blur() function invocation, if you have jquery you can introduce this simple logic

     $(yourObj).is('body') 

    to check if your object is the body element, in order to avoid blur() function invocation on it

提交回复
热议问题