Skip to content

Instantly share code, notes, and snippets.

@tytskyi
Created December 11, 2014 09:20
Show Gist options
  • Save tytskyi/9d8f302ab3844851ac46 to your computer and use it in GitHub Desktop.
Save tytskyi/9d8f302ab3844851ac46 to your computer and use it in GitHub Desktop.
// Easy way to parse raw URL without regex.
var locator = document.createElement('a');
locator.href = 'http://google.com/?search=true&other=isnt#anchor'
console.log(locator.protocol);
console.log(locator.host);
console.log(locator.search);
console.log(locator.hash);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment