Saturday, July 24, 2021

Detect HTTP or HTTPS then force HTTPS in JavaScript

necesitaba redireccionar una pagina en http a https


 if (location.protocol !== 'https:') {

    location.replace(`https:${location.href.substring(location.protocol.length)}`);

}


https://stackoverflow.com/questions/4723213/detect-http-or-https-then-force-https-in-javascript

No comments:

Post a Comment