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

后端 未结 2 1838
慢半拍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

提交回复
热议问题