// gives the hostname and port number, if available window.document.location.host //gives the hostname only window.document.location.hostname //gives the port number, if available. window.document.location.port // gives the protocol name; http for general web requests window.document.location.protocol //gives the path of the file under the domain name window.document.location.pathname // gives the full URL window.document.location.href
The most interesting property is hash.
//gives the hash portion of the URL window.document.location.hash
E.g. for URL http://www.pragneshkaria.com:8082/index.php#tab2
Additionally, jQuery offers the URL parsers to perform additional operation on the current or custom URLs.