IE8 + iframe: window goes to background #2821

pbosakov opened this Issue Oct 24, 2011 · 4 comments


None yet

2 participants


When a jquery mobile page is loaded in an iframe, it causes IE8 browser window to lose focus.

Affected system:
Windows XP Professional SP3
Microsoft Internet Explorer 8

Steps to reproduce:

  1. Open any (non-minimized) application window in the background
  2. Open IE8 in the foreground, with only one browsing tab
  3. Go to

The whole IE window goes in the background when the jquery mobile code executes.

Expected result:
The IE window should stay in the foreground.


Traced the issue to line 3028:

$( document.activeElement || "" ).add( "input:focus, textarea:focus, select:focus" ).blur();

Apparently in IE8, activeElement returns the body element, and using the blur() method on it causes this behaviour.

On my website I replaced this line with the following code. You may verify and possibly commit it.

if(document.activeElement) {
if(document.activeElement.nodeName.toLowerCase() != 'body') {
} else {
$( "input:focus, textarea:focus, select:focus" ).blur();


Thanks for tracking this down. Mind making a pull request?


Sure, I'll make a pull request as soon as I can. Thanks


Closed by: 8387919

@toddparker toddparker closed this Nov 13, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment