admin管理员组文章数量:1415139
When setting up routes on backbone.js, it seems the framework automatically preprends # to it. I.e.
routes : { "example/:id" : "handler" },
will match a link of www.example/#example/123
Is it possible to add the hashtag later on in the url? I'm essentially trying to build my app as www.example/text/#example/123 (notice the text/ before the #).
Is there anyway of doing this without altering the backbone.js framework itself?
When setting up routes on backbone.js, it seems the framework automatically preprends # to it. I.e.
routes : { "example/:id" : "handler" },
will match a link of www.example./#example/123
Is it possible to add the hashtag later on in the url? I'm essentially trying to build my app as www.example./text/#example/123 (notice the text/ before the #).
Is there anyway of doing this without altering the backbone.js framework itself?
Share Improve this question asked Aug 8, 2011 at 1:31 bijanvbijanv 1471 gold badge1 silver badge10 bronze badges1 Answer
Reset to default 1If your server serves the page containing your app to www.example./text
, then the backbone router will handle urls like www.example./text#example/123
. It probably isn't advisable (even if your server supports it) to serve your page on www.example./test/
, because that url indicates that it is a folder, not a particular page.
The backbone router pretty much ignores the baseurl (except for storing it and using it with pushState and popState), so you can serve your page on any url you want.
Hope htis helps.
本文标签: javascriptBackbonejs URL RoutingStack Overflow
版权声明:本文标题:javascript - Backbone.js URL Routing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745226889a2648647.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论