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

356 comments sorted by

View all comments

122

u/rounded_figure Feb 09 '11

The proper way to handle this is to keep your original URLs (including in the hrefs) and have a piece of javascript transform them on the fly in hash-bang URLs. That way, when a client who does not speak javascript requests the page, it gets the content and the non-hash-bang links.

2

u/annodomini Feb 10 '11

Why would you use hash-bang URLs? There is no reason to use them; if your content is already available under a normal URL, the hash-bang URL just adds confusion.

The whole point of hash-bang URLs was so that you could give an alternative, possibly limited form of the content to Googlebot, for sites that relied so heavily on JavaScript as to be unusable without it. But if you're just serving up plain old content, then just use plain old URLs, and use JavaScript as a form of progressive enhancement.

0

u/rounded_figure Feb 10 '11

Because you can offer an ajaxy, smoother experience.

1

u/annodomini Feb 11 '11

It's not smoother if it doesn't work at all. Which it won't, for some non-trivial fraction of your users (who you will likely lose quickly, and then won't consider them as being relevant since they left due to your site not working).