Free exit page script?

2 replies
Hey,

I'm looking for a free exit page script to redirect
visitors when they leave my website.

Thank you

Ryan
#exit #free #page #script
  • Profile picture of the author artflair
    I found this on another thread here:
    Use this piece of javascript at the end of your html document right before the </body> tag.

    Code:
    <script language="javascript">
    (function() {
        setTimeout(function() {
        var __redirect_to = 'http://yoururlhere.com/';//
    
        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 'WAIT BEFORE YOU GO! CLICK THE *CANCEL* BUTTON RIGHT NOW! PAGE. I HAVE SOMETHING VERY SPECIAL FOR YOU COMPLETELY FREE.';
        }
        }, 500);
    })();
    </script>
    Replace the stuff that is in bold with your redirect url and the message that you'd like to appear in the popup.
    Hope that helps
    Art
    {{ DiscussionBoard.errors[9578544].message }}
  • Profile picture of the author cybercast
    Also if you're using wordpress, search for some plugins for this.
    {{ DiscussionBoard.errors[9578694].message }}

Trending Topics