Not exactly the same as following redirects but this is fairly common behavior with browsers when they follow links

Assume we are on https://site.com, the following HTML link would direct the user to https://site.com/page.

Like wise, if we are on http://site.com, the following would direct the user to http://site.com/page


Code
<a href="//site.com/page2">
    Download
</a>


For intents and purposes, its basically a way to say "use the same protocol you previously used"