function SSLRedirect() { if (window.location.protocol == "http:") { window.location = "https://" + window.location.hostname + window.location.pathname + window.location.search; } } SSLRedirect();