homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

window.open in Javascript

 10:44 am on Aug 28, 2002 (gmt 0)

I have a page named "page1.htm" containing the following javascript:

<script language="JavaScript">
var myWindow8;
myWindow8 = window.open('blank.htm','myExample8');
setTimeout("myWindow8.location.href = 'testpage.htm'",10000);

This script opens the page blank.htm. This page is then focused. When I now use the keycombination Control - N the page blank.htm is opened again. So now I have two browser windows open with "blank.htm". After 10 seconds the first browserwindow with "blank.htm" changes into "testpage.htm" (see javascript above), but the second browserwindow stays the same.

Is there way to change both windows in testpage.htm (using the Ctrl - N method)? And in which browsers will this work?




 11:03 am on Aug 28, 2002 (gmt 0)

Hi Markie,

Welcome to WebMasterWorld... I'm sure that you'll find it a fantastic resource, as I certainly have!

It may be worthwhile having a look at the TOS [webmasterworld.com], and the welcome post [webmasterworld.com] by paynt (a moderator here). They are both excellent introductions to posting here!

I reckon that because this script is in the original page that opens the new, blank.html page - when you hit Ctrl-N on blank.html, the setTimeout script is not at all associated with it.

A better way may be to use a meta refresh tag in the head of blank.html, <meta http-equiv="refresh" content="10;URL=testpage.html">. This means that any opening of blank.html will automatically refresh to testpage.html after 10seconds.

This method will work in all browsers...



 5:47 pm on Aug 28, 2002 (gmt 0)

The question occurs, though: Why is this a concern? How many people are realistically going to Ctrl-N on a popup?


 7:11 am on Aug 29, 2002 (gmt 0)


My company does something with Micropayments on the internet. So its absolutely necessary to change all windows opened.

Please advise...............


 7:24 am on Aug 29, 2002 (gmt 0)

It sounds like you need to load the new page from a javascript (or a meta-refresh) called by blank.html, rather than doing it all from page1.html.


 7:52 am on Aug 29, 2002 (gmt 0)

That is not an option, because I only have the control over page1.htm.


 10:27 am on Aug 29, 2002 (gmt 0)

If you only have control over page1.html, and cannot alter the code in testpage.html and blank.html, then I would say that there is no easy way of doing this at all - But, I look forward to being corrected! :)

Once a user opens a new page, independent of any of your script, then you have little to no control over that page.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved