File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes window.open() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "window.open()" Watch "window.open()" New topic
Author

window.open()

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have a line like this in a copule pages:

newWindow = window.open(url,"windowname");

If I run this once it opens a new window. Per this page if I make the call again without closing the new window, it activates and reloads the same window again. This is nice.

I have code in the opened window to send data back:

window.opener.method( the data );

I open page 1 in an IFrame and open window X. It does some stuff and calls back to opener. Well & good. I close page1 and open page2. Page2 also opens window X and since it already exists it just activates the existing one. Good. Then window X references window.opener and it's no good. Makes sense.

So (finally) I changed my open to this:

newWindow = window.open(url,"windowname");
newWindow.opener = window

This seems to work but I'm a bit surprised that opener was not read only or something. Does this sound kosher? Should I expect it to work?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
 
subject: window.open()
 
Similar Threads
How to show a pop up window from a servlet
window.open question
Setting the column width of an Excel
Opening HTTPS link in same popup
having problem with going back