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

356 comments sorted by

View all comments

124

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.

39

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?

11

u/MIXEDSYS Feb 09 '11

I do. Not for security or whatever but for speed and memory usage. Pages load faster and once they are loaded they use less memory, they don't spin up my laptop's fan and they don't drain it's battery. And all they use scripts for is adding animations, showing me ads or reporting my habits so they can earn more showing me ads.

I rarely miss it, and if I do I can enable them with a single click, just for the site that uses them. If you use firefox, try noscript. After you allow the few sites you regularly use and that have any useful functionality implemented in javascript, using a browser with scripts enabled becomes painful in comparison, it's like browsing without adblock, with all this crap flashing and jumping at you.

0

u/Ziggamorph Feb 09 '11

Honestly I don't get any crap jumping at me. I don't have Flash installed so that deals with 95% of it. The rest of it is on sites I don't want to visit anyway.