I just installed my new homepage at http://ritter.vg . I use jQuery, but very minimally.
It loads all pages using AJAX - I configured it to bookmark it by detecting a hash in the url.
//general functions function getUrl(u) { return u + '.html'; } function loadURL(u) { $.get(getUrl(u), function(r){ $('#main').html(r); } ); } //allows bookmarking var hash = new String(document.location).indexOf("#"); if(hash > 0) { page = new String(document.location).substring(hash + 1); if(page.length > 1) loadURL(page); else loadURL('news'); } else loadURL('news');
But I canβt get the back and forward buttons to work.
Is there a way to detect when the back button was clicked (or determine when the hash changes) without using the setInterval loop? When I tried those with a latency of 0.2 and 1 second, it bound my processor.
javascript ajax fragment-identifier hashchange navigation
Tom Ritter Oct 06 '08 at 1:18 2008-10-06 01:18
source share