Does that possibility exist? Our site is not one page, but all js-files compressed inside of application.js
, can I use backbone router for location.path
parsing?
I try Backbone.history.start(pushState: true)
. It works for me, but is it correct? I need just initial parsing, not complicated routes and redirects via Backbone.Router
.
I am using this:
to get absolute url of backbone app's root.
You'll need to write your own router, but fortunately that's pretty easy. Here's one I just wrote for a site I'm working on:
I didn't need any of the fancy matching rules that Backbone provides, but it wouldn't be too hard to extend this idea with regular expressions. Or perhaps someone could write up a little module that uses Backbone's matching logic but doesn't do the hash/pushState redirection.
You can just use a standard router. When you instantiate it and start the history object you can set what the root directory it should use as its base. In this case it seems you want to to use '/'
You'll need to set your web server to serve up your HTML file whenever any directory is called on your server (so backbone, not rails, will handle your routes).
Finally, in the HTML file I have a function which runs on Dom ready and pulls the path out of the URL and passes it to
navigate
.I had the same IE issue, there is a simple sollution. Download modernizr and include it.
Then do:
This should do the trick.