0

I want to start using JavaScript frameworks - and thought I would try Backbone or Marionette as it is very modular and flexible (from what I can tell).

The only thing that is bothering me at the moment is that they both seem to depend on Routing through hash changes. This is not something I can use, as I have a strict URL structure.

Is there a simple way to change this? Like the template tags in Underscore.JS - or is it a little more tricky?

One problem I have is that I am not using Node.js, this is a traditional server set up on Apache (in case the answers rely on Node).

Every example / tutorial I have seen/read/watched/followed depends on the hash change as they are single page web apps. Is this the design of Backbone and Marionette? I can deal with no page refreshes - but need the URL's to change to traditional MVC style ones

JustSteveKing
  • 968
  • 1
  • 10
  • 29
  • `need the URL's to change to traditional MVC style ones`. Just a heads up, but MVC has nothing to do with the URL. What I'm assuming you're referring to is a "pretty URL" which is commonly implemented with MVC frameworks that use RESTful API's. It's very possible to have long, ugly URL's while using an MVC framework. – user3476345 Dec 18 '14 at 07:18

1 Answers1

2

You need to enable pushState. And it will only work in modern browsers

Backbone.history.start({pushState: true})

Backbone.Router and Backbone.History

Alexus
  • 1,887
  • 1
  • 23
  • 50
aleha_84
  • 8,309
  • 2
  • 38
  • 46
  • Would [this](https://github.com/browserstate/history.js) not aide in supporting older browsers with the pushState set to true? Just a thought. I have **no idea** how it could be integrated though! – JustSteveKing Dec 17 '14 at 14:41