Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
97
rated 0 times [  100] [ 3]  / answers: 1 / hits: 30628  / 8 Years ago, thu, march 31, 2016, 12:00:00

In my website blog pages added query string in that page URL. I wanted to remove the query string from the URL. So i used to go with jquery and i wrote and added into my scripts. It removes the query string but keep on refreshing the page upto nth time. I used to one jquery method. That also doesn't work.



Can you help me



My Script is



jQuery(document).one('ready',function(){
window.location.href = window.location.href.split('?')[0];
});

More From » jquery

 Answers
5

setting a value to window.location.href will reload the page. Try this:



    var url = window.location.href;
var a = url.indexOf(?);
var b = url.substring(a);
var c = url.replace(b,);
url = c;

[#62752] Monday, March 28, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gavenmekhio

Total Points: 732
Total Questions: 89
Total Answers: 93

Location: Central African Republic
Member since Mon, Aug 10, 2020
4 Years ago
;