This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

disabling windows close icon

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all.
 
Nothing up my sleeve ... and ... presto! A tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!