location.href
location.replace
document.URL
从其他类似问题可以看出,我们能否整合所有这些可能的方法?
答案 0 :(得分:1)
var customURL = 'http://www.example.com';
window.location.href = customURL;
window.location.assign(customURL);
// Current page won't get saved in the history:
window.location.replace(customURL);
// Gecko only:
window.document.location = customURL
另见: