0
location.href
location.replace
document.URL

从其他类似的问题可以看出,我们可以整合所有这些可能的方法吗?

4

1 回答 1

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

也可以看看:

于 2012-04-21T09:42:30.110 回答