Website URL decomposition

http://www.joymood.cn:8080/test.php?user=admin&pwd=admin#login


1, location.href: obtained as the entire full url

2, location.protocol: to give the transport protocol http:

3, location.host: get hostname along with the port http://www.joymood.cn:8080/

4, location.hostname: get hostname http://www.joymood.cn/

5, location.pathname: After obtaining the host part does not include the question mark after /test.php part?

6, location.search: get url after the question mark in the part before the pound sign # user = admin & pwd = admin??

7, location.hash: partially #login before #

Guess you like

Origin www.cnblogs.com/zjz666/p/11201807.html