Pop up that can't be closed using browser close button

I have googled this to death and understand that the browser close button cannot be disabled via javascript.  I also know that this is not a good idea in most cases, however I am developing a web-based front end for a database using coldfusion that requires this ... or another solution I haven't thought of.  This is not for public use, but rather for a small group of in house users.  I could simply tell them "don't close the browser using the red X", but I have experience with these users and they will forget ... things have to be more bullet proof for them.

I am creating a 7 step wizard with a form for each step.  The user must either complete the 7 steps, or click the close button I have added to the pop up (onclick = window.open....), otherwise my cookie management fails and causes all kinds of problems.

At first I thought I could do a simple "onunload=window.opener.location.replace ..." but I encountered a problem.  To explain, when the form on each step is submitted, it the page technically is "unloading" and the JS script runs, which removes some cookies, causeing problems.

I read many times to add fullscreen=yes to the 'window.open' which is supposed to hide the tool bar, but that does not appear to work ...

... the only thing I can think of is to either disable or hide the browser close button or start over and create some sort of modal popup (which I don't really want to have to do as I am way behind on this project as it is)

Max
LVL 1
MaxwellTurnerAsked:
Who is Participating?
 
AngryBinaryConnect With a Mentor Commented:
I'm afraid you are genuinely out of luck. If the design of your application absolutely depends on nobody closing their browser using the browser close button, then you should re-evaluate the design (I mean, are the long-term training prospects even feasible?)

What you ought to be looking for is a way to make your application "state-less" - in other words, nothing is committed until all steps are completed, so if the user bails out suddenly in the middle of the process, no information is left in an invalid state. How that can be done will require a little more exploration into the process - I'm sure you can think of some reasons why that would be difficult, so articulate those and we can work around them.
0
 
COBOLdinosaurCommented:
Instead of a popup use an absolutely positioned div that sits on top and populate it using AJAX.  They can't close the div unless they close the whole page; something you would never be able to control.


Cd&
0
 
MaxwellTurnerAuthor Commented:
Thanks AngryBinary,  

I liked your 'stateless' recommendation and decided to take your advice.  I only have 23 variables, so I'm just passing the variables as they accumulate in hidden [input]'s  It is fairly simple (except for a couple contingencies where the user jumps back a few steps ... makes for a loong urls!), but I have it working mostly, just need some tweaks.  This method also solves some other issues that are no longer issues ,so thanks!  Wish I had decided this from the start ... C'est la vie!

Max
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.