location对象有以下属性:
-
location.href: 返回或设置当前页面的URL
-
location.protocol: 返回或设置当前页面的协议(http、https等)
-
location.host: 返回或设置当前页面的主机名和端口号
-
location.hostname: 返回或设置当前页面的主机名
-
location.port: 返回或设置当前页面的端口号
-
location.pathname: 返回或设置当前页面的路径部分
-
location.search: 返回或设置当前页面的查询字符串部分
-
location.hash: 返回或设置当前页面的URL中的锚点部分