: 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
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.
More posts by @Angie530
1 Comments
Sorted by latest first Latest Oldest Best
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
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.