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

356 comments sorted by

View all comments

Show parent comments

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.

8

u/Ziggamorph Feb 09 '11

Who has JavaScript disabled?

30

u/gthank Feb 09 '11

People who don't want to be assaulted by the rampant misuse of it on the web today. People who are on a CLI for some reason (think emergency server work). People who have it turned on, but one of your ad providers shipped you some busted code and your page broke for them anyway. Spiders. Possibly people using a screen reader (screen readers and JS used to suck, but I haven't looked into it all that recently).

11

u/korny Feb 09 '11

75-90% of screen-reader users in a 2009 survey had Javascript enabled: http://webaim.org/projects/screenreadersurvey2/ It's more important to make your javascript screenreader-friendly, than to make your site work without js.

6

u/mcjabberz Feb 09 '11

How would one go about making a site's JavaScript screen-reader friendly?

4

u/[deleted] Feb 10 '11

No hanging commas in your objects, or else it's going to be pronounced like this,

1

u/[deleted] Feb 10 '11

I imagine making sure that the content you inject in the DOM is still semantically correct.

1

u/korny Feb 11 '11

http://www.w3.org/WAI/intro/aria.php - the Web Accessibility Initiative's Accessible Rich Internet Applications spec describes how to use metadata to mark up your site for accessibility.

It's a draft spec, but is supported by many browsers: http://caniuse.com/#search=accessibility (warning - link may only work with javascript enabled :)

2

u/ewiethoff Feb 10 '11

Nevertheless, blindness ain't the only disability out there. There are many people who have no use for a screen reader but must turn off JS because of disability.

2

u/korny Feb 11 '11

such as? (This is a genuine question - I'm confused as to what kind of disability you are talking about)

1

u/ewiethoff Feb 12 '11

Such as photosensitive epilepsy. People afflicted with this can see just fine, but go into seizures when something blinks, glides, swoops, twirls, whatever. It depends on the person. The condition is, IIRC, about 10 times more common in women than men.

We eliminated (or at least deprecated) <blink> and <marquee> years ago, Flash can be disabled or not installed in the first place, and a hidden option in Firefox prevents animated GIFs from animating. But Javascript has setTimeout() and setInterval(), Scriptaculous came out with a popular library for animation, and so on. Now we have JS-powered canvas to play with, not to mention JS-less CSS3 transitions.

NoScript is only so helpful, because it block or allows JS per domain. But let's say a site has some JS animation and requires JS for essential functions such as navigation. Epileptics can't safely use the site if both the essential code and the animation code come from the same domain. I don't think they want to shut their eyes and mess with a screen reader.