BUG: Renavigation of Existing Window Through window.open Creates a New Window Under Internet Explorer 5.5 (269658)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 5.5

This article was previously published under Q269658

SYMPTOMS

When you call the window.open method on an existing window, a new window is created when you set the replace parameter to true.

RESOLUTION

To resolve this problem, you can keep track of the window handle and use the location.replace method to renavigate the window if the window already exists. When you use location.replace, you ensure that the new navigation replaces the current entry in that browser window's history.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

The following generic HTML code reproduces the problem:
<HTML>
<BODY>
<script language=javascript>

	function handle_openwindow(location) {
	  window.open(location,"mystatic_window",null,true);
	}

</script>

<INPUT type=button value="open new window" 
onclick="handle_openwindow('http://www.microsoft.com');" id=button1 
name=button1>
<INPUT type=button value="re-navigate window" 
onclick="handle_openwindow('http://msdn.microsoft.com');" id=button2 
name=button2> 

</BODY>
</HTML>
				
The following code is a possible workaround for the preceding example:
<HTML>
<BODY>
<script language=javascript>
	var my_window_handle

	function handle_openwindow(location) {

		if (typeof my_window_handle == "object") {
		    my_window_handle.location.replace(location);
		 }
		else { my_window_handle = 
window.open(location,"mystatic_window",null,true); }
	}

</script>

<INPUT type=button value="open new window" 
onclick="handle_openwindow('http://www.microsoft.com');">
<INPUT type=button value="re-navigate window" 
onclick="handle_openwindow('http://msdn.microsoft.com');"> 

</BODY>
</HTML>
				

REFERENCES

For more information about the window.open method, please see the following site: For more information about the JScript typeof Operator, please see the following site: For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

Modification Type:MajorLast Reviewed:5/11/2006
Keywords:kbbug kbDHTML kbnofix KB269658