What happens to code after a javascript redirect (setting [removed].href)?

后端 未结 2 1826
慢半拍i
慢半拍i 2020-11-29 09:25

I have the following javascript redirect code followed by some more code.

window.location.href = \'/someurl\';
alert(\'hello\');
alert(\'hello again\');


        
相关标签:
2条回答
  • 2020-11-29 09:43

    The browser will try to execute the code after window.location.href = 'url' until the page goes to the next web adress, so the number of lines of code that will be executed depends on the browser's speed

    0 讨论(0)
  • 2020-11-29 09:53

    The Javascript session will struggle to continue it's mission in the face of impending doom. Coding in this manner is considered unpredictable. ...and cruel.

    0 讨论(0)
提交回复
热议问题