Backbone Router: Get Rid of # in the URL

I get a trunk router to work

App.Router = Backbone.Router.extend({
      routes: {
        "todo": "todo"
      },
      todo: function() {
        alert(1);
      }
});
Backbone.history.start();

This works well when I get url: domain: port / # / todo

I want this to work without # in the url, I tried setting the pushState parameter as indicated in the docs.

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

It just redirects # url to non-hashed

domain: port / # / todo (redirected to ==>) domain: port / todo

But when I visit this URL directly

domain: port / TODO

it does not work: "Unable to get / todo".

Is there any way I can get this URL to work without # in it?

+1
source share
1 answer

, URL.

pushState : " JS , , , URL".

, URL-, .

+3

Source: https://habr.com/ru/post/1533796/


All Articles