Skip to content

Instantly share code, notes, and snippets.

@dubravkoL
Created November 4, 2014 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dubravkoL/db5058678d0b228e70ad to your computer and use it in GitHub Desktop.
Save dubravkoL/db5058678d0b228e70ad to your computer and use it in GitHub Desktop.
parseUrl.js
var a,
url = 'http://m.cg/';
a = document.createElement('a');
a.href = url;
console.log(a.protocol); // "http:"
console.log(a.hostname); // "m.cg"
console.log(a.pathname); // "/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment