The function below checks the current URL and if it is HTTP, it will force change to HTTPS.
function checkRedirect() {
console.debug("checkRedirect");
var protocol = window.location.protocol;
console.debug("checkRedirect: current protocol is ", protocol);
if (protocol == "http:") {
var newUrl = "https://" + window.location.hostname + "/" + window.location.pathname;
console.debug("checkRedirect: redirect page to ", newUrl);
window.location = newUrl;
console.debug("HTTPS redirect is disabled");
}
}
No comments:
Post a Comment