Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> He suggests using real URLs - instead of "/#!5753509/hello-world-this-is-the-new-lifehacker" we would have "/5753509/hello-world-this-is-the-new-lifehacker". Sounds great, but what happens when you click to a new article, which is loaded with AJAX?

I would deliver the page with plain old HTML links to other pages. On page load I'd use JavaScript to see if the new pushState[1] API is available, and if so fetch the JS required to update the page dynamically and then update the link elements to do the AJAXy thing. Seems like it would degrade gracefully in old browsers and keep the URL current in new browsers.

[1] https://developer.mozilla.org/en/DOM/Manipulating_the_browse...

edit: is sjs382 my doppelganger?! (or vice versa)



Yes, if I were forced to use JS for loading the primary content I would do that too. There are a couple of options for doing so if you don't want to roll your own (and you don't - it is actually a very complex thing to get working cross browser), JQuery History [1] which is nice and simple, and JQuery BBQ if you need a bit more control.

Personally I think it's a little early for pushState, and degrading to #! is really ugly, so for now I would say just use normal page loads like everyone else unless you have a really good reason (good reason: GMail. bad reason: glorified blog.)

[1] http://tkyk.github.com/jquery-history-plugin/ [2] http://benalman.com/projects/jquery-bbq-plugin/


Agreed. I meant degrade to regular URLs, not the #! thing. IMO you don't need the #! for something as simple as switching articles.


edit: is sjs382 my doppelganger?! (or vice versa)

Haha, not at all. Just my old university ID since "sjs" was taken here ;)


sjs can be a hard handle to get. had to resort to _sjs on twitter, and that was in 2007 :)


Well now you know who to blame :^).


Not me. :p I'm sjstrutt on Twitter




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: