jQuery remove query string parameter from url

jQuery remove query string parameter from url

A query string is the part of a URL that includes field-value pairs.

Here we are going to remove query string from URL using JavaScript.

There are number of benefits of clean URL.

Clean URL always looks better and prevent user to see if you are tracking where they came from.

It is helpful for security reasons.

Example 1 :
  1. $(document).ready(function(){
  2.     var uri = window.location.toString();
  3.     if (uri.indexOf("?") > 0) {
  4.      var clean_uri = uri.substring(0, uri.indexOf("?"));
  5.      window.history.replaceState({}, document.title, clean_uri);
  6.     }
  7. });
Example 2 :
  1. var clean_uri = location.protocol + "//" + location.host + location.pathname;
  2. window.history.replaceState({}, document.title, clean_uri);

Phone: (+91) 8800417876
Noida, 201301
sakarya escort sakarya escort sakarya escort bayan sakarya escort serdivan escort sakarya escort sakarya escort serdivan escort
karasu escort akyazı escort serdivan escort akyazı escort ferizli escort sapanca escort serdivan escort söğütlü escort sakarya escort izmit escort arifiye escort erenler escort hendek escort kocaali escort pamukova escort taraklı escort geyve escort