Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The window.history takes focus now
Message
From
07/06/2001 20:18:54
 
 
To
07/06/2001 19:50:14
General information
Forum:
Internet
Category:
Javascript
Miscellaneous
Thread ID:
00516591
Message ID:
00516715
Views:
16
>There is something weird in the way those windows work. When I tried var newWin and newWin.focus() at the end, it didn't work. So, I decided to do the history first and then window.open. It didn't work as well. In both situations, the focus is set back to the original window.
>
>If I remove the history, all is ok, however, the original window is blank and I want it to be back to where it was prior to the post.

I made a mistake in the code posted before. Try this one. It works for me.
Notice the use of 'self' as opposed to 'this'. Sorry.
< HTML>
< HEAD>
< META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
< TITLE></TITLE>
< SCRIPT LANGUAGE=javascript>
< !--
 function nw(){
	var newWin = window.open("test2.htm","windowname");
	newWin.opener = self
	self.name = "Main"
	window.history.back()
	newWin.focus()
}
// -->
< /SCRIPT>

< /HEAD>
< BODY>

< P>< input type="button" onclick="nw()" value="NEW WIN"></P>

< /BODY>
< /HTML>
This is what I do to try it:
I access any page in my browser window; then go to this page (via link or entering the URL); then click on the button.
This is what happens: the new window opens with a page that I created (test2.htm), and the main window goes back to the previous page. The focus stays on the new window.

Let me know if it works for you.
Andres M. Chiriboga, MCSE, MCP+I
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform