DEV Community

Cover image for How to change Address bar URL without refreshing the page using JavaScript
Sh Raj
Sh Raj

Posted on • Updated on

How to change Address bar URL without refreshing the page using JavaScript

Main Article :- https://codexdindia.blogspot.com/2020/12/how-to-change-adress-bar-url-without.html

Documentation Video :- https://www.youtube.com/watch?v=nTiRTyh6ayg


window.history.pushState('new' , 'title' , 'new.html')
Enter fullscreen mode Exit fullscreen mode

Uses :-
1. Use setTimeout's ....
2. Use in Button onclick

Let's use it in a function...

 function change(url) { 
   window.history.pushState('new' , 'title' , url) ;
  }
Enter fullscreen mode Exit fullscreen mode

See Demo Here :- https://codexdindia.blogspot.com/2020/12/how-to-change-adress-bar-url-without.html

Checkout Instagram :-


Top comments (0)