JavaScript方法:
1 2 3 4 5 |
// 类似于系统自动跳转 window.location.replace("//www.dustit.me"); // 类似于用户点击操作 window.location.href = "//www.dustit.me"; |
模仿用户点击操作时请用 window.location.href
方法。
jQuery 方法:
1 2 3 4 |
// jQuery 跳转到指定页面 $(location).attr('href','//www.dustit.me') $(window).attr('location','//www.dustit.me') $(location).prop('href', '//www.dustit.me') |