controlling window exit options?

2 replies
I know how to make a function that uses window.onbeforeunload=myfunction;
but you are limited to displaying an alert. That is not what I want.

Has anyone found a way to stop the exit and run a function.
something like:

$('popup').show();

If so... you could make a greybox styled popup that showed a downsell
when the user tried to leave.

no.. you can not just do

function myfunction(){
$('popup').show();
}

the exit will still work and you function wont do anything.
You have to stop the exit from working before you can do something.
Nothing has worked... we nothing other then alerts.
I can do all kinds of alerts.

jquery .unload() also only allows for an alert.

I dont want to say.. "hey dont leave" with a dumb cancel or stay link.
I want a full downsale.


Thanks Gordon
#controlling #exit #options #window
  • Profile picture of the author gaetanoc
    This might help you out...

    Code:
    window.onbeforeunload = function() { 
        return 'You have made changes on this page that you have not yet confirmed. 
        If you navigate away from this page you will loose your unsaved changes';
    }
    Signature
    An experienced technical programmer wants to JV with you


    I will build any kind of software, bots, web applications, desktop applications, mobile applications - you will handle marketing and sales.
    {{ DiscussionBoard.errors[5399447].message }}
    • Profile picture of the author frenchsquared
      Originally Posted by gaetanoc View Post

      This might help you out...

      Code:
      window.onbeforeunload = function() { 
          return 'You have made changes on this page that you have not yet confirmed. 
          If you navigate away from this page you will loose your unsaved changes';
      }

      That only opens the alert.
      I have that working, then my div shows under neither that. lke a greybox,
      popup but it is my own version.
      you can see it here Foods That Make You Fit, Foods That Make You Fat

      I don't want that alert. I don't think it can be done.
      {{ DiscussionBoard.errors[5400427].message }}

Trending Topics