-2

Is it possible for the backbone router to recognize that the URL it is running on is different?

I need the behavior of the app to change before the hash-bangs.

/members#login

vs

/members/benefits#about (Need the app to behave differently here)

g5insider
  • 109
  • 9
  • 1
    Possible duplicate of [Get the current URL with JavaScript?](https://stackoverflow.com/questions/1034621/get-the-current-url-with-javascript) – Emile Bergeron Sep 29 '17 at 15:36
  • Not a duplicate. I'm not asking about backbone being able to detect routes before the hashbang. Not how to get the window.location.href. – g5insider Sep 29 '17 at 16:44
  • 1
    Backbone is a JS lib, use JS to get whatever you want in the URL and go from there. There's nothing specific about Backbone here. You could check [`pushState`](http://backbonejs.org/#History-start) is that fits your need. – Emile Bergeron Sep 29 '17 at 16:46

1 Answers1

1

If you want to control behavior of the app depending on the url that is not part of hash, you should use pushState. Otherwise backbone router only deals with the part after hash. In that case you can implement the logic yourself.

T J
  • 42,762
  • 13
  • 83
  • 138