backbone.js - What is pushState for? -


i saw latest backbone.js (0.5) introduced pushstate option routing.

after reading through https://developer.mozilla.org/en/dom/manipulating_the_browser_history have not clear me : pushstate , pushstate brings, in context of writing web app backbone; :

  • improving urls: have 'real', bookmarkable, 'server-reachable' url, opposed hashes?

  • graceful degradation: allow server render correct pages without js enabled ?

  • both/none of above, or other reasons ?

also, 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 navigate http://localhost#hello, url changed http://localhost/#hello, callback not fired ?

thanks

you don't need # prefix in routes table. try this:

  routes :     ''       : 'index'     'hello'  : 'hello' 

as pushstate think both of above. mean more work on server-side have location hash because going have make sure server can serve pages urls.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -