Skip to content

Instantly share code, notes, and snippets.

@tristen
Created May 26, 2011 19:42
Show Gist options
  • Save tristen/993895 to your computer and use it in GitHub Desktop.
Save tristen/993895 to your computer and use it in GitHub Desktop.
// 1. if mailto: return it all
// (mailto\:)
// 2. if http/https return the relative path
// ([http?s]\:\/\/)?(\/.*) ------------> .exec(path)[2]
// 3. If there is a hash, return everything after the hash
// ....
@miccolis
Copy link

get a url

if it's http or https,

 then strip off the scheme and domain etc...

if not

 just return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment