user1781186
user1781186

Reputation:

Backbone.js History.js url conflict?

Are Backbone.js and History.js not meant to both be included in the same page?

I'm working in an environment where History.js is used, and for some reason it replaces all the URL hashes which my Backbone router relies upon.

Every example.com/#hey/babe is being replaced by example.com/hey/babe which obviously does not work well with Backbone hash routing.

Upvotes: 2

Views: 453

Answers (1)

user1781186
user1781186

Reputation:

Ok, I'm not 100% sure what is going on here, but I solved the issue by setting some options in Backbone's history object.

Backbone.history.start({ 
    pushState: true, 
    hashChange: false, 
    root: '/mysite/app/' 
});

Upvotes: 3

Related Questions