domainmadness
Supreme Member
- Jun 22, 2011
- 1,313
- 474
Is there any good working exit redirect plugins? Not looking for exit popup, just redirect from current page to another one when mouse is leaving.
window.location = "http://www.google.com/"
<script type="text/javascript">
function addEvent(obj, evt, fn) {
if (obj.addEventListener) {
obj.addEventListener(evt, fn, false);
}
else if (obj.attachEvent) {
obj.attachEvent("on" + evt, fn);
}
}
addEvent(window,"load",function(e) {
addEvent(document, "mouseout", function(e) {
e = e ? e : window.event;
var from = e.relatedTarget || e.toElement;
if (!from || from.nodeName == "HTML") {
// stop your drag event here
// for now we can just use an alert
alert("left window");
}
});
});
</script>
alert("message" window.location = "http://www.url.com");
Confimation window (Ok \ Cancel):so in firefox this will automatically redirect to the target page, in chrome the visitor has to hit ok to be redirected.
What do I enter in alert to have a box pop up with a message that redirects to a site? I tried a few things and now there is no pop up or redirect.
Currently I have:
Code:alert("message" window.location = "http://www.url.com");
if (window.confirm('Blah blah blah, click ok to proceed')) {
window.location.href='http://www.url.com/';
}
if (window.alert('You will proceed to our updated site.')) {
window.location.href='http://www.url.com/';
}
this is the first time I have played with java. copy/paste didn't work and the few things I could think to try as variations did not get me there. I will look at it again in the morning. Thanks for the help.
<script type="text/javascript">
window.alert('You will proceed to our updated site.')
window.location.href='http://www.google.com/';
</script>
<script type="text/javascript">
window.confirm('Blah blah blah, click ok to proceed'
window.location.href='http://www.google.com/';
</script>
so in firefox this will automatically redirect to the target page, in chrome the visitor has to hit ok to be redirected.
What do I enter in alert to have a box pop up with a message that redirects to a site? I tried a few things and now there is no pop up or redirect.
Currently I have:
Code:alert("message" window.location = "http://www.url.com");
<script type="text/javascript">
function addEvent(obj, evt, fn) {
if (obj.addEventListener) {
obj.addEventListener(evt, fn, false);
}
else if (obj.attachEvent) {
obj.attachEvent("on" + evt, fn);
}
}
addEvent(window,"load",function(e) {
addEvent(document, "mouseout", function(e) {
e = e ? e : window.event;
var from = e.relatedTarget || e.toElement;
if (!from || from.nodeName == "HTML") {
// stop your drag event here
// for now we can just use an alert
//alert("left window");
window.location = "http://www.google.com/"
}
});
});
</script>
Goodbye - just mouseout the window...
dont want to resume this old thread, but there is a method to stop firing the redirect when just using the scroll-bar? would be nice to have redirect only when the mouse exit up or down from the page and if he close the page or click the back button