Get and Set URL parameter in javascript
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/purl/2.3.1/purl.js"></script> | |
<script> | |
// Get the URL parameter | |
var argName = $.url().param('argName'); | |
// Set the URL parameter | |
if (argName == null) { | |
history.pushState(null, null, '/?argName=defaultValue'); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment