Is JavaScript location.href call is asynchronous?

前端 未结 1 1242
清酒与你
清酒与你 2021-01-11 15:03
function fun(){
    console.log(\"Hi\");
    window.location.href=\"http://www.google.com\";
    console.log(\"Hello, how are you\");
    alert(\"I am good\");
    f         


        
相关标签:
1条回答
  • 2021-01-11 15:30

    A browser will execute code after window.location.href = 'http://google.com until the browser goes to the next web address. As such, the number of lines that will be executed depends on some combination of the browsers speed or later synchronous input from the user (an alert in your case).

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