Omdirigera till SSL - CSS-tricks

Anonim
window.location = "https://" + window.location.hostname + window.location.pathname + window.location.search;

Du kanske vill testa om window.location.href inte börjar med “https” innan du gör det, så du omdirigerar inte om du inte måste.