JavaScript基础知识之——Location 对象详解

属性描述
location.hash 设置或取得 URL 中的锚
location.host 设置或取得 URL 中主机(包括端口号)
location.hostname 设置或取得 URL 中的主机名
location.href 设置或取得完整 URL(页面重定向应用)
location.pathname 设置或取得 URL 中的路径
location.port 设置或取得 URL 中的端口号
location.protocol 设置或取得 URL 使用的协议
location.search 设置或取得 URL 中的查询字串(一般是 ? 符号后面的内容)
原文地址:https://www.cnblogs.com/tinywan/p/5959429.html