wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes check if the window is new or old ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "check if the window is new or old ?" Watch "check if the window is new or old ?" New topic

check if the window is new or old ?

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
hi all,

Is it possible to check if the browser window is old or a new one. If i click on a link, the new page opens on the same window but if i right click the link and select "open in new window" it opens the page in a new window. is it possible to track this ?

thanks in advance ,

SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
JavaScript/HTML/Server has no control over the newly created window.
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
You can track it from the page in the new window using the window.history object. After a few very cursory tests, it seems like window.history.length for a new window in Firefox will be 1, while it will be 0 in IE.
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
Thanks for the replies !!

I have few more questions. Please dont think that Im just posting my issues here without trying to find a solution

1. Is is possible to check if the user has clicked the referesh button on the browser. I mean, the page has been displayed afterwards if the user clicks the refresh button on the browser i want to display an alert message.

2. Is it possible to find the number of children of a parent window. if i right click on a link and opens the result in new window, can i find how many child windows has already been opened ?

I agree. Here's the link: http://aspose.com/file-tools
subject: check if the window is new or old ?
Similar Threads
new window
child window count
action class gets skipped when opening link via javascript
Does mailto open only outlook or default mail client
Applet initialization problem