简体   繁体   中英

pushstate is not working correctly in backbone.js

If I am using Backbone with pushstate, how should I format my links?

Currently I am doing this:

<a href="task/create">create task</a>

If I use the above format, it actually sends a GET request to the server, which serves a standard page and backbone correctly identifies that it should go to task/create , which it does, and shows the view.

But why is it sending a GET request in the first place? (even though I have set pushstate to true?)

edit: I am using the latest version of Chrome (as of August 2011), so my browser is not a problem, I think.

ok got it answered from here. https://github.com/documentcloud/backbone/issues/456

clicking links are not suppose to be pushstate friendly. one may try to live bind it via jquery and use custom function to create that effect.

如果其他读者想了解有关路由的更多信息,请在此处的第32-46页中整整一章专门介绍路由, 网址为http ://samples.leanpub.com/marionette-gentle-introduction-sample.pdf(完整披露) :我是本书的作者)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM