good exit popup script that's non wordpress based for when user attempts to close window?

by ak2000
4 replies
hi

what is a good exit popup script that's non wordpress based for when user attempts to close the window?

essentially i am after a script that shows a hover-over form (or any piece of html) as soon as the visitor moves with his mouse towards the X to close the window or navigate away (before he clicks on the X itself)

thanks!
#attempts #based #close #exit #good #popup #script #user #window #wordpress
  • Profile picture of the author tacitinc
    here ya go

    Code:
    <!--- Exit Pop --->
    
    <script language="javascript">
    (function() {
    setTimeout(function() {
    var __redirect_to = 'http://www.google.co.uk';//
    
    var _tags = ['button', 'input', 'a'], _els, _i, _i2;
    for(_i in _tags) {
    _els = document.getElementsByTagName(_tags[_i]);
    for(_i2 in _els) {
    if((_tags[_i] == 'input' && _els[_i2].type != 'button' && _els[_i2].type != 'submit' && _els[_i2].type != 'image') || _els[_i2].target == '_blank') continue;
    _els[_i2].onclick = function() {window.onbeforeunload = function(){};}
    }
    }
    
    window.onbeforeunload = function() {
    setTimeout(function() {
    window.onbeforeunload = function() {};
    setTimeout(function() {
    document.location.href = __redirect_to;
    }, 500);
    },5);
    return '********************************nnATTENTION!!!! nnDo not leave this pagennClaim your exclusive offer todaynn********************************';
    }
    }, 500);
    })();
    </script> 
    
    <!--- Exit Pop --->
    {{ DiscussionBoard.errors[8935717].message }}
  • Profile picture of the author ak2000
    thanks you're a DUDE
    {{ DiscussionBoard.errors[8936354].message }}
  • Profile picture of the author tacitinc
    No problem man - Just paying it forward

    I wish I would have focused on exit pops wayyyy earlier than I have, its amazing how much extra I earn now with such a simple method most overlook

    Cheers
    {{ DiscussionBoard.errors[8937482].message }}
  • Profile picture of the author MonopolyOnline
    Excellent!

    Just tested it out. It works great.

    Modify the "redirect_to" and the "return" wording, and you are good to go.
    {{ DiscussionBoard.errors[8938400].message }}

Trending Topics