aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes  disabling windows close icon 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 " disabling windows close icon" Watch " disabling windows close icon" New topic
Author

disabling windows close icon

Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
Hi All,

In my application, I am having a pop up window having two buttons SUBMIT and CANCEL. My requirement is not to allow the user to close the pop up window until and unless user click on this two buttons.

Please any body help me. Thanks in advance.
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
Controlling the browser's controls is not permitted using Javascript as such. This is an inherent security feature in every browser out there, so well, it would serve you better to think of an alternative. Besides, even if say, hypothetically, there was a way to disable the close button, the user could have always pressed Alt + F4 or closed the browser through the application manager.
As a rule of thumb [atleast as of this date], you should remember that, browser level operations like - Back, Forward, Close, etc, cannot be suppressed by javascript.

One thing you could do is have a Javascript method associated with the "onUnload" event of the <body>. You can alert a message to the user saying that he/she should have clicked one of the buttons.
[ April 08, 2008: Message edited by: Anirvan Majumdar ]
Mehul Wani
Greenhorn

Joined: Mar 18, 2008
Posts: 18
Hi,

You cannot hide/disable the close box of the popup since,this is a browser window one cannot have control on its control buttons like minimize/close. However, you can use custimized popups made up of <div> tags.
Anubhav Anand
Ranch Hand

Joined: May 18, 2007
Posts: 341

Hello Ingoba Ningthoujam,

It is not feasible to disable the window close icon or control it's behaviour.

PS. many companies would have died for it if it was possible e.g. the porn site owners and spam popup's etc.
Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
Thanks all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: disabling windows close icon
 
Similar Threads
Message box problem
Strange issue in JSF pagenation
pass control from child page to parent page
Any other way for Customize confirmation alert Msg Box??(Mr. Al Ian)
Web Application, Struts (filling grid problem)