29

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)?

alex
  • 479,566
  • 201
  • 878
  • 984
Continuation
  • 12,722
  • 20
  • 82
  • 106
  • 1
    If this question gets merged with a duplicate, please retain @alex's answer. It is better than Zach's answer in the other post. – Greg Sep 29 '11 at 00:26
  • I'm reopening this since the original was deleted. It only contained a link to a blog for an answer. – Bill the Lizard Sep 29 '11 at 11:17

2 Answers2

31

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.

alex
  • 479,566
  • 201
  • 878
  • 984
4

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.

scalopus
  • 2,640
  • 3
  • 19
  • 32