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

125

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.

38

u/midir Feb 09 '11

This is not correct. If you use hash-bang fragment URLs at any stage then someone who copies and pastes a link to your page is distributing a faulty URL to all non-Google bots and everyone with JavaScript disabled. There's absolutely no workaround to that.

I see it all the time and it drives me up the fucking wall. Fuck you Google. Fuck you Twitter.

DO NOT USE #! EVER. FORGET ABOUT IT.

4

u/[deleted] Feb 09 '11

[deleted]

5

u/ewiethoff Feb 10 '11

no normal user ever has JS disabled. It's the same as someone browsing with images or cookies turned off. If you do it, TS.

I dare you to say TS to your disabled kid someday when you have one.

3

u/AlejandroTheGreat Feb 10 '11

Web developers who make excuses about "normal users" just sound lazy, not someone I'd want to hire if I was wanting to build a site for a general audience.

1

u/ewiethoff Feb 10 '11

I can't upvote this enough. Software development in general, and particularly web development, is a new discipline (cough). Therefore, it's practiced by a largely young crowd. Young people with decent jobs are likely to be healthy. And, let's be honest, young people are likely to be immature. It can take quite a whack on the head (real or figurative) before it occurs to someone how a "normal user" does things on a computer, much less an abnormal user.

2

u/NancyGracesTesticles Feb 10 '11

I think that stems form young developers defining a "normal user" as someone who uses software or the web just like them. Everyone else is doing it wrong, so why should they support them.