Skip to content

Instantly share code, notes, and snippets.

@youngchief-btw
Last active December 8, 2021 00:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youngchief-btw/d8c327ef245f2e9998997a41c7b34e70 to your computer and use it in GitHub Desktop.
Save youngchief-btw/d8c327ef245f2e9998997a41c7b34e70 to your computer and use it in GitHub Desktop.
HTTP --> HTTPS enforcement in Javascript
// HTTP --> HTTPS
if (location.protocol === "http:") {
location.replace(window.location.href.replace("http:", "https:"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment