Link to home
Start Free TrialLog in
Avatar of MaxwellTurner
MaxwellTurnerFlag for Canada

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of AngryBinary
AngryBinary

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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&
Avatar of MaxwellTurner

ASKER

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