Posted in Code Snippets, Javascript

Using query string in script tag

It is possible to send query string to an external JavaScript file like this:

< script src="scripts.js?version=123"></script>

Continue reading “Using query string in script tag”

Posted in Code Snippets, Javascript

Get query string value

Get the value of a field from query string using JavaScript:

function getURLParameter(name) {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)
                              [1].replace(/\+/g, '%20'))||null

Continue reading “Get query string value”