URL: Uniform Resource Locator (Uniform Resource Locator, URL)
The complete URL is composed of these parts:
Scheme://host:port/path?query#fragment
Scheme: Communication protocol
Commonly used Http,ftp,maito, etc.
Host: Mainframe
Server (computer) domain Name System (DNS) hostname or IP address. Port: Port number
integer, optional, omitting the default port for the scenario, such as HTTP with a default port of 80. Path: Paths
a string separated by 0 or more "/" symbols, typically used to represent a directory or file address on a host. Query: Querying
is optional for dynamic Web pages, such as using CGI, ISAPI, php/jsp/asp/asp. NET, and other technology-made pages, can have multiple parameters, separated by the "&" symbol, and the name and value of each parameter are separated by the "=" symbol. Fragment: Pieces of information
string that specifies a fragment in a network resource. For example, a Web page has multiple noun interpretations, which can be directly positioned to a noun interpretation using fragment. (also known as anchor points.) 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 each of these parts
1, Window.location.href
the entire URL string (which is the complete address bar in the browser)
This example returns a value of: 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 a value: Http:3,window.location.host
the host part of the URL
This example returns a value: Www.x2y2.com 4,window.location.port
the port portion of the URL
If you use the default 80 port (update: Even if you added: 80), the return value is not the default 80 but the null character
This example returns a value of: "" 5,window.location.pathname
the path portion of the URL (that is, the file address)
This example returns a 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 value of the values that are believed
This example returns a value:? ver=1.0&id=6 7,window.location.hash
Anchor Point
This example returns a value: #imhere