Javascript Exit Redirect & Chrome

megatabbers

New member
Jul 21, 2009
1,284
29
0
Boston, MA
I've been playing around with the script provided by Rage9 in this thread (thanks man!):

http://www.wickedfire.com/design-development-programming/89796-javascript-exit-pop.html

It's working fine on IE and Firefox. With Opera the redirect happens after the Cancel button is pressed (good enough) but in Chrome it doesn't redirect at all.

Any ideas as to why?

Thanks in advance.

EDIT: Here's the code:

script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var areYouReallySure = false;
var internalLink = false;
function areYouSure() {
if (!areYouReallySure && !internalLink) {
areYouReallySure = true;
location.href="http://www.mydomain.com/letter.php"
return "*****************************************************\n\nBefore you leave, press **CANCEL** NOW for a very important message.\n\n*****************************************************";
}
}
window.onbeforeunload = areYouSure;

$('a').click(function(){

internalLink = true;

});
});
</script>