1. Set or get the entire URL to a string:
window.location.href
2. Set or get the port number associated with the URL:
window.location.port
3. Set or get the protocol part of the URL
window.location.protocol
4. Set or get the part of the href attribute that follows the question mark
window.location.search
5. Get the value of the variable (intercept the part after the equal sign)
The code copy is as follows:
var url = window.location.search;
// alert(url.length);
// alert(url.lastIndexOf('='));
var loc = url.substring(url.lastIndexOf('=')+1, url.length);
6. Set or get the protocol part of the URL:
window.location.protocol
7. Set or get the segments in the href attribute after the pound sign "#":
window.location.hash
8. Set or get the hostname and port numbers of the location or URL:
window.location.host