• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to stop browser pange closing without showing confirm dialog box

 
Venkata Ramana
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I need to stop my browser page closing when user clicks on 'X' symbol located at top right carner.
i used the following html and javascipt code.

The above code is working fine.
When the user clicks on 'X' symbol, it will promt in confirm dialog box.If user clicks on 'ok' the browser window will close. if user clicks on 'cancel' the browser don't close.
I don't want to display the confirm dialog box, and i want my browser window to be opened.
(i.e. actually i want to cancel the event which fires when 'X' button is clicked.)
ramana
 
Randall Twede
Ranch Hand
Posts: 4467
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont think you can thank god!
although i have been to sites that popped up windows faster than i could close them ive never been unable to close one. you can make them really big so the X is off the screen, but it can still be closed by right clicking on it in the task bar.
 
Heath Lilley
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't STOP them from closing the window but in I.E. 5.5 there is a confirm window of some sort the works a little like an alert. It pops up a mini dialog window with OK and Cancel buttons on the bottom. Here is where you can ask them if they really want to close the window.
If u are writing some kind of webapp you could simulate a call to logout code on the server with the on close method if the user clicks OK.
You can also save the user's session data, at that point, if you need to.
 
Randall Twede
Ranch Hand
Posts: 4467
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
he knows about the confirm dialog box. thats what hes trying to avoid. why do you want to be so mean to your visitors/users anyway?
by the way, you do realize that onbeforeunload only works in IE dont you?
[ April 18, 2002: Message edited by: Randall Twede ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do an onunload pop up of the same page they were on......But most people will close them before they will open.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic