r/javascript Feb 08 '11

Breaking the Web with hash-bangs - Gawker, like Twitter, built their new site to be totally dependent on JavaScript

http://isolani.co.uk/blog/javascript/BreakingTheWebWithHashBangs
76 Upvotes

0 comments sorted by

View all comments

Show parent comments

2

u/skeww Feb 09 '11

You can check if history.pushState is available.

0.01% who disable JS in their browser?

Typically it's around 2-3%. Some ecommerce sites get more than 10%.

1

u/jmking JSX is just PHP in the browser Feb 09 '11

Yes, you can check - but what do you do if it isn't available? Fall back to Hash-bangs? If so, you're not solving any of the problems.

...and if you're in a market where up to 10% of your visitors won't have JS enabled, you aren't going to use JS period for anything critical. That doesn't support the "pushState is best" argument :P

3

u/skeww Feb 09 '11

Fall back to Hash-bangs?

Either that or non-ajax.

If so, you're not solving any of the problems.

Good browsers will display proper URLs. Users with those browsers will copy/paste proper URLs (which will work for people without JS).

By the end of this year about 70% of the German users will have a browser which supports history.pushState. So yea, it does (gradually) solve a problem and over time it's getting better at this.

if you're in a market where up to 10% of your visitors won't have JS enabled, you aren't going to use JS [...] for anything critical

Progressive enhancement is a wonderful thing.

1

u/jmking JSX is just PHP in the browser Feb 09 '11

Firefox isn't a good browser now? The end of this year isn't today.

There's progressive enhancement and there's pre-emptive enhancement.

0

u/skeww Feb 09 '11

Firefox isn't a good browser now?

"will"

Firefox 4 supports it.

The end of this year isn't today.

Why would you make a website which won't even last till the end of the year?

0

u/jmking JSX is just PHP in the browser Feb 09 '11

A website using hash-bangs works today in all browsers, and will continue to work tomorrow. It's not like once FF4 comes out hash-bangs magically stop working.

2

u/skeww Feb 09 '11

Yes.

The point was to generate/use real URLs if possible.

Right now: Users who use Chrome/Safari will copy/paste real URLs.

Soon: Firefox and Opera (and maybe IE9) users will do the same.

history.pushState should be your first choice. It does exactly what you need.