Skip to content

Instantly share code, notes, and snippets.

@jcamp
Created August 3, 2018 10:18
Show Gist options
  • Save jcamp/af18ba7e54602b2c9ddd660a03e6828d to your computer and use it in GitHub Desktop.
Save jcamp/af18ba7e54602b2c9ddd660a03e6828d to your computer and use it in GitHub Desktop.
Check and set js variable if running http or https
var isHttps = location.protocol.match(/https/);
var http = isHttps ? 'https://' : 'http://';
var site_url = http + location.host + '/webpage';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment