JavaScript Modify URL Without Reloading Page
JavaScript Modify URL Without Reloading Page: There are many ways to replace the current url. The methods window.history.pushState() and window.history.replaceState() can be used to change the url without reloading the page. These two methods are basically used to add or modify the history entries. Here in this tutorial we are going to explain how you can change the url without reloading the page.
JavaScript Modify URL Without Reloading Page Example
Here is an example of window.history.pushState() to replace the url without reloading the page.
JavaScript Modify URL Without Reloading Page Example:
<script type="text/javascript"> var newUrl = "www.tutorialsplane.com/javascript?s=viewall"; history.pushState({}, null, newUrl); </script> |
The above example will replace the current url with eht newUrl.
Advertisements