Alternative for URLSearchParams

IE doesn’t support “URLSearchParams”. So sometimes your script will not work in IEs.

So the alternative for the “URLSearchParams” is as below.

window.getUrlParameter = function( keyword, query_string ) {
    keyword = keyword.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp( keyword + '=([^&#]*)');
    var results = regex.exec( query_string );
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));


We can use the above function like this:

Suppose you have query string like “abc=test&action=wow” and you want to search values of the particlular query string. So you can use it something like below:

var query_string = 'abc=test&action=wow';

getUrlParameter( 'abc', query_string ); // You will get value "test"

getUrlParameter( 'action', query_string ); // You will get value "wow"

Related Articles

Add custom filter for searching post or users in WordPress backend

For this, two parts are important. Part 1: Adding select dropdown Below is the action by which we can add a new search filter for…

Fun @ WordCamp Pune

In my previous blog First WordCamp, I covered what we have done in WordCamp. Now in this blog, you will know what fun we did…

The last day ( છેલ્લો દિવસ )

Hi there, The last day, yes I am talking about the last day of the year 2016. Another year passed and I became 26 in…

Edit old commit message on github

Sometimes we make mistake in git commit message, especially spelling mistake. Even though I think twice before pressing the enter key after I write the…

Install wp-cli on windows

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser.

So I am going to tell you short, simple and easy way that how to use wp-cli on windows system.


Leave a Reply