Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   IE7 problem when using popups (http://www.go4expert.com/forums/ie7-using-popups-t3366/)

alejandro 12Mar2007 20:20

IE7 problem when using popups
 
Hey everyone, I'm currently working on a php project that started about 3 years ago (meaning, it's already quite large.).

It uses quite a lot of pupups that seem to work great in all browsers... or used to until IE 7 came along.

The problem is, if I have a link that generates a popup but also relocates the page where the link was clicked, the main page will come on top of the popup when it starts loading (this does not occur in any other browser other than IE 7.). This occurs if the page has an onload event that sets focus somewhere in the page.

I will provide an over-simplified example, try it out in FF, IE 6, and IE 7 to see what I mean:
Code:

<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'  );
        newWindow.focus(); // This will execute, but afterwards the window that executes
                          // it will reload and come on top of the popup window
      }
    </script>
  </head>
  <body>
    <a href='popup.html' onclick="popup();">Click Me</a>
    <input id='inputThing' type='text'></input>
  </body>
</html>



All times are GMT +5.5. The time now is 12:18.