moonman407
moonman407

Reputation: 23

How do I specify HTTP or HTTPS dependent on the current URL?

My code specifies

this._restUrl = "http://" + this._info.host + "/app/rest/"; 

The problem is I can't figure out how to make it use "https://" when using SSL. How can I turn this into an http or https statement? This works fine for http as it is.

Upvotes: 2

Views: 88

Answers (1)

Ry-
Ry-

Reputation: 225281

You can use a relative protocol:

this._restUrl = "//" + this._info.host + "/app/rest/";

Here’s a good description of those.

Upvotes: 3

Related Questions