JavaScript:在同一窗口中打开新页面的方法

JavaScript:在同一窗口中打开新页面的方法,javascript,html,url,dom,location-href,Javascript,Html,Url,Dom,Location Href,从其他类似问题可以看出,我们能否整合所有这些可能的方法 location.href location.replace document.URL 另见: URL是DOM Level 0 document.location.href属性的替代品。但是,document.location.href是可设置的,而document.URL不是。@ashimsha实际上,它是window.location看到他们说的了吗- var customURL = 'http://www.example.c

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

location.href
location.replace
document.URL
另见:


URL是DOM Level 0 document.location.href属性的替代品。但是,document.location.href是可设置的,而document.URL不是。@ashimsha实际上,它是window.location看到他们说的了吗-
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