Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

check if the window is new or old ?

 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ,
rajeev.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript/HTML/Server has no control over the newly created window.
 
Garann Means
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

Thanks,
Rajeev.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic