if (window.location.protocol == "http:") { window.location.replace("https://mydomain.com"); }