JS原生location对象

假设当前 url 是 http://192.168.31.194:8000/jquery/index.html?a=3&c=aa#b

location.href // 完整的url
location.hostname // 192.168.31.194
location.host // 192.168.31.194:8000
location.port // 8000
location.protocol // http:
location.search // ?a=3&c=aa
location.hash // #b
location.pathname // /jquery/index.html

你可能感兴趣的:(JS原生location对象)