Should I use window.navigate or [removed] in JavaScript?

前端 未结 11 1722
小鲜肉
小鲜肉 2020-11-27 12:12

What\'s the preferred method to use to change the location of the current web page using JavaScript? I\'ve seen both window.navigate and document.location used. Are there an

11条回答
  •  醉酒成梦
    2020-11-27 13:15

    window.location also affects to the frame,

    the best form i found is:

    parent.window.location.href
    

    And the worse is:

    parent.document.URL 
    

    I did a massive browser test, and some rare IE with several plugins get undefined with the second form.

提交回复
热议问题