File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes How to disable browser close button 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 "How to disable browser close button" Watch "How to disable browser close button" New topic

How to disable browser close button

Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
I have my pop-up comming and i did not want user to close that pop-up by clicking on the window cross(X) button at the top right of it.
Can I do anything to stop user from doing it?
Thanks in advance.

- Varun
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
I do recommend that you get used to searching and looking at past messages here. This sort of question seems to come up every few days. See this thread and this thread for more discussion.
The bottom line is that you can try a few things, which may sort of work in particular browsers, but essentially the Web doesn't work that way.
Is it just the (X} close button you want to disable? What if a user closes the window from the task bar or task manager (on Windows) or by killing its process (on Unix)? What if a user opens a different web page in your pop-up window?
Can you give us some more details about why you wnat to do this. Maybe we can help find a solution which will be more "browser-friendly".

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: How to disable browser close button
It's not a secret anymore!