Redirect HTTP to HTTPS only if the browser supports Let's Encrypt SSL/TLS certificates


Why use this script?

How to use this script?

Copy and paste the following script tag code as the first item into the <head> of every webpage you want to redirect to HTTPS from HTTP (if the browser supports it):

<script src="https://https.netlify.com/redirect.js"></script>

How does this script work?

The redirection script itself is hosted on Netlify with HTTPS enforced using a Let's Encrypt certificate. Therefore, when the script is requested by the browser, from your page(s), it will only load and execute the redirect to HTTPS if the browser in fact supports the HTTPS certificate. Otherwise, the browser will refuse the connection, not load the script and not perform a redirect; keeping the user on the non-secured HTTP URL.