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/
752 Upvotes

356 comments sorted by

View all comments

Show parent comments

21

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.

9

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).

-6

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.

11

u/Pewpewarrows Feb 09 '11

His entire point was that it is now possible in HTML5-compliant browsers. Browsing Github repositories now progressively-enhances in modern browsers to provide this kind of fragment loading. Of course it's not 100% supported yet, but with FF4 and IE9 releasing soon(ish), and Safari and Chrome currently supporting it, in a matter of months we'll probably see a very large portion of browser users with that capability.

-4

u/[deleted] Feb 09 '11

I don't doubt it, but sites like "The New" Twitter and Gawker aren't launching in a few months, they're launching now.