Go to any GitHub page and click on any of the directories/files and observe how the URL changes but only part of the page is updated. There's no whole page reloading.
How do I do something similar using jQuery?
Does this work on most browsers (I'm using Chrome)?
history. pushState({page: "another"}, "another page", "example. html"); This will change the URL, but not reload the page.
the page using JavaScript? the page using JavaScript? Method 2: Adding a new state with pushState() Method: The pushState() method is used to add a new history entry with the properties passed as parameters. This will change the current URL to the new state given without reloading the page.
They use the history API, or specifically, history.pushState()
.
You can use this, jQuery is not required, but there are plugins such as history.js.
This works on most browsers, namely Chrome, Safari and Firefox. IE10 and above supports this. In older IEs, you can fall back onto using the hash (window.location.hash
).
GitHub also blogged about this.
Github use PJAX (Ref). You may see about jquery-pjax here. Note that this feature is not covered support by all browser, there are some browser that cannot be use this benefits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With