Skip to content

Instantly share code, notes, and snippets.

@nayosx
Created August 20, 2015 23:54
Show Gist options
  • Save nayosx/ad14e2e26ac3e896e3f6 to your computer and use it in GitHub Desktop.
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
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