Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 27th Dec 2013, 10:23 PM   #1
Deon Lundy
 
dlundy1's Avatar
 
Join Date: 2012
Location: Atlanta, GA
Posts: 150
Thanks: 11
Thanked 18 Times in 18 Posts
Default
On Exit SCRIPT
Share on: 
fb share twitter share gplus share more share

I need a script that will redirect users to an EXIT page before they actually exit.

I tried using...

<!-- Exit script -->

<script language=javascript>
window.onbeforeunload = function () {
window.location = 'http://www.website.com/page.html';
return false;
}
</script>

<!-- -->


but for some reason even the RELATIVE links are redirecting me to the exit page.

Need help

Thanks

Don't Give UP! See how I made mt first $69.73 online :)
dlundy1 is offline  
Unread 27th Dec 2013, 11:56 PM   #2
PHP ninja
War Room Member
 
kevbo22's Avatar
 
Join Date: 2011
Location: Denver
Posts: 124
Thanks: 13
Thanked 27 Times in 25 Posts
Default
Re: On Exit SCRIPT
Share on: 
fb share twitter share gplus share more share

http://www.warriorforum.com/programm...ml#post5999679

The best path to prosperity is free market capitalism!
kevbo22 is offline  
The Following User Says Thank You to kevbo22 For This Useful Post:
Unread 28th Dec 2013, 02:41 AM   #3
Active Warrior
War Room Member
 
Join Date: 2013
Posts: 48
Thanks: 0
Thanked 9 Times in 9 Posts
Default
Re: On Exit SCRIPT
Share on: 
fb share twitter share gplus share more share

Originally Posted by dlundy1 View Post

I need a script that will redirect users to an EXIT page before they actually exit.

I tried using...

<!-- Exit script -->

<script language=javascript>
window.onbeforeunload = function () {
window.location = 'http://www.website.com/page.html';
return false;
}
</script>

<!-- -->


but for some reason even the RELATIVE links are redirecting me to the exit page.

Need help

Thanks
That script will popup if theres a domain included in the links is that the case?
softwarewarden is offline  
Unread 29th Dec 2013, 04:43 PM   #4
Deon Lundy
 
dlundy1's Avatar
 
Join Date: 2012
Location: Atlanta, GA
Posts: 150
Thanks: 11
Thanked 18 Times in 18 Posts
Default
Re: On Exit SCRIPT
Share on: 
fb share twitter share gplus share more share

Originally Posted by softwarewarden View Post

That script will popup if theres a domain included in the links is that the case?
No, no domain included.

only relative links

Don't Give UP! See how I made mt first $69.73 online :)
dlundy1 is offline  
Unread 29th Dec 2013, 04:52 PM   #5
Deon Lundy
 
dlundy1's Avatar
 
Join Date: 2012
Location: Atlanta, GA
Posts: 150
Thanks: 11
Thanked 18 Times in 18 Posts
Default
Re: On Exit SCRIPT
Share on: 
fb share twitter share gplus share more share


That worked! Awesome! thanks everyone!

Here is the CODE that I used that worked!

<script language="javascript">
(function() {
setTimeout(function() {
var __redirect_to = 'http://www.DOMAIN.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. GET YOUR FREE DISCOUNT COUPON.';
}
}, 500);
})();
</script>

Don't Give UP! See how I made mt first $69.73 online :)
dlundy1 is offline  
Closed Thread


Bookmarks

Tags
exit, script


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 07:44 AM.