Created
June 17, 2013 22:31
-
-
Save ricardodantas/5801084 to your computer and use it in GitHub Desktop.
Get / parse URL via javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // If URL is http://www.somedomain.com/account/search?filter=a#top | |
| window.location.pathname // /account/search | |
| // For reference: | |
| window.location.host // www.somedomain.com (includes port if there is one) | |
| window.location.hostname // www.somedomain.com | |
| window.location.hash // #top | |
| window.location.href // http://www.somedomain.com/account/search?filter=a#top | |
| window.location.port // (empty string) | |
| window.location.protocol // http: | |
| window.location.search // ?filter=a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment