10
I saw the latest backbone.js (0.5) introduced the pushState option for routing.
After reading through https://developer.mozilla.org/en/dom/manipulating_the_browser_history I have to say it is not very clear to me : what pushState is and what exactly it is that pushState brings, in the context of writing a web app with backbone; is it for :
improving urls: to have a 'real', bookmarkable, 'server-reachable' url, as opposed to hashes?
graceful degradation: allow the server to render correct pages without JS enabled ?
both/none of the above, or other reasons ?
Also, what am i doing wrong below ?:
class MyRouter extends Backbone.Router
routes :
'' : 'index'
'#hello' :'hello'
index : -> console.log 'index'
hello: -> console.log 'hello'
new MyRouter
Backbone.history.start pushState: true
When I navigate to http://localhost#hello, the url is changed to http://localhost/#hello, but the callback is not fired ?
Thanks