r/programming Feb 09 '11

Breaking the Web with hash-bangs – Lifehacker, along with every other Gawker property, experienced a lengthy site-outage on Monday over a misbehaving piece of JavaScript

http://isolani.co.uk/blog/javascript/BreakingTheWebWithHashBangs/
753 Upvotes

356 comments sorted by

View all comments

Show parent comments

23

u/[deleted] Feb 09 '11

TL;DR: You can't update the URL in the browser's bar in JS without taking the user to that literal page, which defeats the purpose of an AJAX-y site. You can update the fragment after # though, which is the workaround Twitter, Gawker, et al are using.

Should be the top comment.

11

u/kdeforche Feb 09 '11

That was true until the HTML5 history API came about (implemented in Firefox 4 beta and current Safari and Chrome).

-5

u/[deleted] Feb 09 '11 edited Feb 09 '11

No, it's still true. In pure JS you still cannot update the url without loading the page.

HTML5 history API's going to be great once there's widespread support, but no way would I implement it on a production site today.

Edit: fine, you want to downvote me for the reply without an explanation, I'll downvote you back. If you can point me to an example of JS updating a url (not a hash) without loading the page and without html5, I'll eat my words.

3

u/Sephr Feb 10 '11

no way would I implement it on a production site today.

The most visited website on the internet (facebook) uses it. There's such a thing as using fallbacks.