Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q269658

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Status

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

↑ Back to the top


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>
				

↑ Back to the top


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:

↑ Back to the top


Keywords: KB269658, kbnofix, kbdhtml, kbbug

↑ Back to the top

Article Info
Article ID : 269658
Revision : 7
Created on : 10/26/2007
Published on : 10/26/2007
Exists online : False
Views : 387