Posted By: adimare | Mar 12th, 2007 @ 3:10 PM
page 1 of 1
Comments: 3 | Views: 2105
hello, I'm having some trouble with IE7 and was wondering if anyone else has encountered this issue.

I'm currently working on a system that uses quite a lot of popups and have encountered with an issue, I present an oversimplified example.

The file popup.html conatains:

<html>
  <head>
    <script language='javascript'>
      window.onload = function (){ window.document.getElementById('inputThing').focus(); };
      function popup(){
        var newWindow = window.open('popup.html','','width=200,height=200');
      }
    </script>
  </head>
  <body>
    <a href='popup.html' onclick="popup();">Click Me</a>
    <input id='inputThing' type='text'></input>
  </body>
</html>


In FF and IE 6 or lower, clicking on the link opens the popup, relocates the main window, and gives focus to the popup.
On IE 7, however (because of the focus event launched onload in the newly-opened main window), after the main page loads the focus is taken from the popup and given to the main window, causing the popup to get behind the window.
stevo_
stevo_
Casablanca != Manchester
As a matter of principal, I would always call focus on the popup window, just incase it is already opened, it will then cause it to come to the front anyway.

This may or may not fix your problem.

function popup(){
  var newWindow = window.open('popup.html','','width=200,height=200');
  newWindow.focus();
}
page 1 of 1
Comments: 3 | Views: 2105