Skip to content

Instantly share code, notes, and snippets.

@craigbutcher
Created August 7, 2015 14:28
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 craigbutcher/afbfa7f37a39df1781c0 to your computer and use it in GitHub Desktop.
Save craigbutcher/afbfa7f37a39df1781c0 to your computer and use it in GitHub Desktop.
Checking for spaces and replacing them with HTML URL encoding %20
// Get the href path
var path = linkClicked.attr('href');
// Does it contain spaces? If so, convert them to HTML URL Encoding Reference - %20
path = path.replace(/ +/g, '%20');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment