Skip to content

Instantly share code, notes, and snippets.

@youngchief-btw
Last active December 8, 2021 00:13
Show Gist options
  • 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