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

前端 未结 11 1750
小鲜肉
小鲜肉 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 12:49

    I'd go with window.location = "http://...";. I've been coding cross-browser JavaScript for a few years, and I've never experienced problems using this approach.

    window.navigate and window.location.href seems a bit odd to me.

提交回复
热议问题