Skip to content

Instantly share code, notes, and snippets.

@cayuu
Created July 9, 2013 04:05
Show Gist options
  • Save cayuu/5954613 to your computer and use it in GitHub Desktop.
Save cayuu/5954613 to your computer and use it in GitHub Desktop.
URL parameter extraction function
function getURLParam( name ) {
return decodeURIComponent(
(new RegExp( '[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)' ).exec( location.search ) || [,""] )[1]
.replace(/\+/g, '%20'))
|| null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment