location一些属性和方法:
首先,一个完整的URL格式:
url: protocal://hostname:port/pathname/file
eg: http://www.baidu.com
location属性:
location.href: 一个完整的url
location.protocal: 协议
location.hostname: 域名
location.pathname: 路径及文件名
location方法:
location.reload(): 重新加载,F5
location.assign(url): 跳转到一个新链接
location.replace(url): 也是跳转到新链接,但是它不能后退
==总结:location = window.location,它的这么多属性与方法肯定是记不住的,所以想知道一个对象有哪些方法,可以这样==
console.log(location)