Max
Max

Reputation: 1459

backbone.js https

Been googling all morning but can't find an answer.

The official documentation does not even have the words "https" or "ssl" on it.

Currently I have something like:

var A = backbone.Collection.extend({
  url : "a"
});

is there a way to make the url https, without using absolute path?

Upvotes: 5

Views: 1830

Answers (1)

Garrett Vlieger
Garrett Vlieger

Reputation: 9494

I don't think you can change the URL to HTTPS since it's just building a relative URL to your location. Why not do something like this:

var A = Backbone.Collection.extend({
  url: function() {
    return "https://" + this.document.location.host + "/a";
  }
});

Upvotes: 3

Related Questions