Tag: type address get HTTP Dynamic Language 1.0 path Port POS
for such a URL
Http://www.x2y2.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere
we can use JavaScript to get every part of it.
1, window.location.href
The entire URL string (in the browser is the full address bar)
This example returns the value: Http://www.x2y2.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere
2,window.location.protocol
the protocol portion of the URL
This example returns the value: http:
3,window.location.host
the host part of the URL
This example returns the value: Www.x2y2.com
4,window.location.port
the port portion of the URL
If you are using the default 80 port (update: Even if you added: 80), the return value is not the default of 80 but the null character
This example returns the value: ""
5,window.location.pathname
the path portion of the URL (that is, the file address)
This example returns the value:/fisker/post/0703/window.location.html
6,window.location.search
Query (Parameters) Section
in addition to assigning values to dynamic languages, we can also give static pages and use JavaScript to get the values of the arguments we believe in.
This example returns the value:? ver=1.0&id=6
7,window.location.hash
Anchor Point
This example returns the value: #imhere <src= "http://feeds.feedburner.com/~s/fisker?i=http://www.x2y2.com/fisker/post/0703/ Window.location.html "type=" Text/javascript "charset=" Utf-8 ">
JS get URL parameter