Mobile app version of vmapp.org
Login or Join
Angie530

: How is github so fast? When you browse repositories on github ( for example https://github.com/mojombo/jekyll/tree/master/bin) it feels like it uses ajax and does not reload the whole page every

@Angie530

Posted in: #PageSpeed

When you browse repositories on github ( for example github.com/mojombo/jekyll/tree/master/bin) it feels like it uses ajax and does not reload the whole page every time. However the url really changes (not just after the # ).

I already found this article where they write about their backend: github.com/blog/530-how-we-made-github-fast
But is this really the whole trick?

My pages never feel that fast and I am already using yslow to optimize it.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angie530

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

The URL change is a mix of an old feature of HTML when calling an A tag with hashes,

<a href="#home">Go to my home</a>
<p>TextTextTextTextTextTextText</p>
<a id="home">


that makes possible linking parts of the same page without reloading at all,
and a new HTML5 JavaScript window object

window.onhashchange


This new object it's a event handler, that fires when a link with hashes is clicked, so it's possible to handle that event with JavaScript and possibiliting browser history and back buttons.
Here's a exemple

function hashChanged() {
if (location.hash === "#home") {
showPage('home');
}
}

window.onhashchange = hashChanged;


Mozzila Developer Network window.onhashchange Page

jQuery hashchange event cross-browser plug-in

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme