my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes Browser Windows(URGENT!) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Browser Windows(URGENT!)" Watch "Browser Windows(URGENT!)" New topic

Browser Windows(URGENT!)

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
I have main.htm in which i have an applet called Main.class
Now, when user open the first instance of browser for main.htm, it should download the main.htm from the server.But when user try to open another instance of the browser for same main.htm, it should not allow to open another instance of main.htm instead it should reference to first instance of main.htm
How can I do this???
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
I think you posted a similar question earlier, since then the only other way of doing this other than server side that I can think of would be:
Use java script to check to see if a cookie has been set if not, set a cookie when main.htm is first opened. If it has been then the only thing you can do is display a message that says they already have it opened and they should refer to that other open instance. You can try to close that window but since the user opened it, it will pop up a confirm message saying that you're trying to close the window.
Have an onunload function that deletes the cookie when they leave the page so it can be reset next time they visit.
Of course if they have cookies disabled then this wouldn't work and you'd have to go with a server side solution - like capturing their ip and holding it until their session is done.
hope that helps

I agree. Here's the link:
subject: Browser Windows(URGENT!)
It's not a secret anymore!