none
IE9 Beta - Javascript Popup Windows Issue

    Question

  • Hello All,

    Our company is currently using javascript based popup windows to open forms for an application.  We use window.open() and self.close() to work with them:

     

    window.open(URL, windowName[, windowFeatures])
    self.close()
    

     

    When ever a user enters information into the form and submits the form,  the data is posted to our database and the window is closed.   A trivial use of a popup window to gather information.

    When you try to re-open that window, the server-side scripting should return the information.  But, it does not.  The original blank form is loaded and no information is retrieved from the database.

    If you hit the reload button, the information is returned.  But,  if you change that information, the same previous information still appears until you hit the refresh button again.

    Obviously, it's a cache problem and the easy fix is to add a random number to the end of the URL.  But, why is this doing this?  It only happens in IE9 Beta and we have no other problems in other browsers.  Our concern is that we'll have to go and update all of our links throughout a very large application.

    I'm sure other people have code similar to ours and will run into this situation.  We're eventually turning to a full CSS based window form entry.  But, that's down the road and we did not expect to run into this situation.

    Using the IE9 developer tools, we changed the Browser Mode and Document Mode but no matter what we had the same problem. 

    Anyone have any information?

    Here's some sample code for a simple test case:

    <!-- Popup Calling Page -->
    <html>
    	<body>
    		<input type="button" value="Open Popup" 
    		 onClick="window.open('popup.html','Test','height=300,width=400,top=0,left=0,scrollbars=yes');"/>
    	</body>
    </html>
    
    
    <!-- Popup window Source -->
    <html>
    <body>
     <form action="submit.php">
     	Your Name <input type="text" maxlength="25" width="23"/>
     	<input type="button" value="submit" onClick="self.close()"/>
     </form>
    </body>
    </html>

    Please let me know if you have any suggestions on where to get an answer!

    Thanks,
    Dave

     

    Friday, October 22, 2010 5:59 PM

All replies

  • I had a lot of problems with formatting of the code...

    Just make sure to use your database script as the action for the form and have that script close the window.

    I'm sure everyone will know what to do :-)

    Dave

    Friday, October 22, 2010 6:05 PM
  • Hi Dave,

    The standard design pattern for a submit button is to validate the data before the input click event is bubbled to the form submit.

    <input type="button" value="submit" onClick="return false;self.close()"/>

    The return false; stops the 'button' onclick event bubbling up after the form submit.

    one would normall use return FormDataValid();

    A ticket at connect.microsoft.com/ie has already been raised, but I beleive this is the expected behaviour, its just that other browsers return false by default.


    Rob^_^
    Friday, October 22, 2010 7:18 PM
  • Hi Rob,

    Thanks for the update. 

    I'm not sure if we're talking about the same thing.  I'm a bit confused.  So, I went ahead and created a testing page for this exact problem.

    Here's the link:

    http://davidmcantwell.x10.mx/

    Using IE9 Beta, click the button and change the value in the window.  Submit the value and then click the button again.  You should see the value didn't change.  If you refresh the window, you'll get the value you updated.

    After that, try it in another browser and you'll see what I mean. 

    My submit.php script closes the window like so:

    <script language="javascript">
      self.close();
    </script>

    Not an actual onClick event.

    Let me know what you think!

    Thanks,
    Dave

    Friday, October 22, 2010 8:13 PM