The answer looks the same as a math puzzle.
In the script I entered, I just posted this code and it seems to work:
window.alert = function (msg) { throw Error('hello'); }
This exception causes the browser to skip the following window.location= statement
source share