Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140190

How to change the page url without reloading the page

$
0
0

I want to know how can I change the page URL without reloading the page or changing the page content. I already use that code (JavaScript):

if(history.pushState){
  window.history.pushState("object or string", "Title", "/");
}else{
  document.location.href = "/";
}

But it doen't work in all browsers and Firefox marks it as insecure. Is there other ways to do what I want in JavaScript/jQuery/.htaccess/HTML meta tags

EDIT:
(1): I want an answer that doesn't use window.history.pushState
(2): Those answers don't help: how to chage url without redirect in javascript? , How do I modify the URL without reloading the page?


Viewing all articles
Browse latest Browse all 140190

Trending Articles