Take the 2-minute tour ×

In our product, we're using the most recent development version of jQuery Mobile in our ASP.NET website. Each and every time we do an ASP.NET postback, the browser window goes to the back of the screen.


  • Maximize any window. Example: Visual Studio, Word, Windows Explorer.
  • Maximize IE9 over it. IE9 is the only thing you see on the screen.
  • Click on a button in our solution that does a postback.
  • IE9 is no longer visible. Whatever was behind it now has focus (and fills the screen, as it is maximized)

Only workarounds I know:

  • Don't include the jQuery mobile scripts.
  • Ensure IE9 is the only maximized window in Windows.

I don't know what jQuery Mobile is doing in the background and am assuming this is a bug in IE9 that will eventually be fixed. However, if you had any tips on how to prevent it from happening in the meantime, that would be great.

Edit: Seems it isn't on every postback. It is on every postback that performs a Response.Redirect. I should add that all my postback are actually utilizing ASP.NET AJAX, not full postbacks.

share|improve this question
PS: I am very surprised that javascript can affect operating system windows in this way. –  Jason Kealey Apr 14 '11 at 0:48
do you have your application in debug mode attached to VS? –  Daniel A. White Apr 14 '11 at 0:49
Nope. Even does it when done on an external server. –  Jason Kealey Apr 14 '11 at 0:53
I can reproduce this, but only when theres just one tab open in IE9. If you open another tab, with a random site, this bug will not occur. –  user859304 Jul 23 '11 at 12:50

4 Answers 4

up vote 13 down vote accepted

I know this is an old post, but for people coming here from Google:

I ran into this same issue today. It seems this lose focus behavior is what IE does when you trigger the blur event on the window object. This was the code that caused this issue for me:


activeElement will default to the body element when there are no other elements in focus, and the blur event then bubbles up to the window. To fix this I simply did a check like:

if (document.activeElement != $('body')[0]) {
share|improve this answer
This makes sense, but I don't have time to test it properly as we found another workaround (Chrome Frame, heh) :) –  Jason Kealey Sep 7 '12 at 17:56

Just posting this link to anybody who is experiencing more of this continued mess. I am seeing the problem on IE 9 and IE 10 on a window.location = 'BLAH', from within the Angular location resource.

This doesn't seem to solve the problem for me, but it may help others:


share|improve this answer

This same issue seems to occur with jQuery Mobile 1.4.2.

When using IE 10, with a single tab open and another window on the same monitor, if you open a popup it will send the browser to the background.

To fix this you have to edit the _handleDocumentFocusIn function. You need to change the line(10391) that reads:



if (targetElement.nodeName.toLowerCase() !== "body")

I made a pull request so hopefully this will be included in the next version.

share|improve this answer

I had similar problem with IE10 and jQuery 1.7.2. I found these lines in my code:




So, adding simple .not('body') resolves the problem:

share|improve this answer
Well written answer and elegant solution, worked for me, many thanks! –  4imble Aug 13 '13 at 16:23

Your Answer


