If I am serving my Backbone application from http://example.com/foo/bar.html, what should I specify the application root as? E.g.:
Backbone.history.start({
pushState: true,
root: '/foo/'
});
vs
Backbone.history.start({
pushState: true,
root: '/foo/bar.html'
});
In fact, does it even matter as far as Backbone routing and history are concerned?
I notice that if I use the former form, images with relative URLs become broken because pushState
would cause the (apparent) location of the window to change to a string like /foo/login
, and then a relative URL like img/orange_cat.jpg
gets resolved to /foo/login/img/orange_cat.jpg
by the browser, when I really want /foo/img/orange_cat.jpg
.