location.hostname 返回 web 主机的域名
location.pathname 返回当前页面的路径和文件名
location.port 返回 web 主机的端口 (80 或 443)
location.protocol 返回所使用的 web 协议(http:// 或 https://)
//获取当前整个页面的URL
document.write(location.href);
//获取当前页面的URL的路径名
document.write(location.pathname);
//Location.assign()方法加载新的文档
function newDoc(){
window.location.assign("http://www.baidu.com");
}
//返回上一页的URL,加载历史列表中的上一个URL
function goBack(){ window.history.back();}
//加载历史列表中的下一个URL
function goForward(){window.history.goForward();}