javascript - Backbone.js URL Routing - Stack Overflow

When setting up routes on backbone.js, it seems the framework automatically preprends # to it. I.e.rout

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 badges
Add a ment  | 

1 Answer 1

Reset to default 1

If 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745226889a4617501.html

相关推荐

  • javascript - Backbone.js URL Routing - Stack Overflow

    When setting up routes on backbone.js, it seems the framework automatically preprends # to it. I.e.rout

    5小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信