Created
August 20, 2015 23:54
-
-
Save nayosx/ad14e2e26ac3e896e3f6 to your computer and use it in GitHub Desktop.
Get params from your HOST via Javascript
Obtener parámetros de tu HOST por medio de javascript
This file contains 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
var parseUrl = (function () { | |
var a = document.createElement('a'); | |
return function (url) { | |
a.href = url; | |
return { | |
host: a.host, | |
hostname: a.hostname, | |
pathname: a.pathname, | |
port: a.port, | |
protocol: a.protocol, | |
search: a.search, | |
hash: a.hash | |
}; | |
} | |
})(); | |
console.log(parseUrl(window.location)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment