Hi, Im not sure why this code is not working on IE browsers but on chrome its working well. This code is for a Popup, that will ask the users if stay or leave page once they try to refresh or go to other webpage. (you can test www.thesuperheroblueprint.com).. and what ever they choose, the should be redirected on a particular page.
<script type="text/javascript">
// Popup window code
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=500,width=600,left=10,top=10,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}
</script>
</div>
<!---Exit Pop-->
<script language="javascript">
(function() {
setTimeout(function() {
var __redirect_to = 'http://thesuperheroblueprint.com/exit.html';//
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>
<!--End Exit Pop-->
Hope you can give me a hint or help to fix this. Thank You