Skip to content

Getting the url parameters inside the html page

I have a HTML page which is loaded using a URL that looks a little like this:


I would like to obtain the query string parameters in the URL without using a jsp.


  1. Can this be done using Javascript or jQuery? Because I want to test my page using my Node.js local server before deploying it in the remote machine which uses a Java server.

  2. Is there any library that will allow me to do that?



A nice solution is given here:

function GetURLParameter(sParam)
    var sPageURL =;
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
            return sParameterName[1];

And this is how you can use this function assuming the URL is,

var tech = GetURLParameter('technology');
var blog = GetURLParameter('blog');`