Home > Web Front-end > JS Tutorial > js gets current page path example explanation_javascript skills

js gets current page path example explanation_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:04:54
Original
1145 people have browsed it

Set or get the "file name" or path specified by the object.
<script><br>alert(window.location.pathname)<br></script>

Set or get the entire URL as a string.
<script><br>alert(window.location.href); <br></script>

Set or get the port number associated with the URL.
<script><br>alert(window.location.port)<br></script>

Set or get the protocol part of the URL.
<script><br>alert(window.location.protocol)<br></script>

Set or get the segment after the pound sign "#" in the href attribute.
<script><br>alert(window.location.hash)<br></script>

Set or get the hostname and port number of location or URL.
<script><br>alert(window.location.host)<br></script>

Sets or gets the part of the href attribute that follows the question mark.
<script><br>alert(window.location.search)<br></script>

Web page refresh recommendation-JS







Related labels:
js
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Where is js written?
From 1970-01-01 08:00:00
0
0
0
js file code not found
From 1970-01-01 08:00:00
0
0
0
js addClass not working
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template