backbone.js https

孤街浪徒 提交于 2020-01-03 13:42:31

问题


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?


回答1:


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";
  }
});


来源:https://stackoverflow.com/questions/11565676/backbone-js-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!