In fact, the error arises from:
window.location.href = 'http://www.google.com/';
And this is just an assumption, but I believe that IE developers wanted to catch it when the user decides not to follow the link. This way you can try to catch this block and you will find out when the user is not redirected (as a result of onbeforeupload).
try { window.location.href = 'http://www.google.com'; } catch (error) { alert("YU NO REDIRECT"); }
If you are console.log(error) , you will see that there is no error message, and the error number is -2147467259.
source share