Hi, im working on a script that confirms if a visitor really want to leave the site. My skills at javascript arent good but i found a working script to do this.
<script>
window.onbeforeunload = function (evt) {
var message = "*****************************************************\n\n
TEXT
\n\n*****************************************************";;
if (typeof evt == "undefined") {
evt = window.close;
}
if (evt) {
evt.returnValue = message;
}
return message;
}
</script>
Now my problem is that with every page change a confirmation is required, i need it to work only when the domain name change, maybe it can be done if the url browser bar value is passed to an IF operation, and if the value isnt the base domain it runs the above function.
The problem is that i dunno how to do that value in JS.
I have fixed it with a cookie check script in php, but its not the way i want it to work at end.
Bookmarks