我的代码指定
this._restUrl = "http://" + this._info.host + "/app/rest/";
问题是我不知道如何在使用 SSL 时使其使用“https://”。如何将其转换为 http 或 https 语句?这对于 http 来说效果很好。
最佳答案
您可以使用相关协议(protocol):
this._restUrl = "//" + this._info.host + "/app/rest/";
关于javascript - 如何根据当前 URL 指定 HTTP 或 HTTPS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16431319/