Let's say that I have a website with SSL certificate and if I type
<a href="https://mywebsite.com"/>
it will send me to that website, and if I type
<a href="http://mywebsite.com"/>
It will also send me to website with redirection to https
protocol
If I have a website without SSL and link to it with
<a href="https://mywebsite.com"/>
I will get something like 'Your connection is not private', or website wont load at all. Here is the catch.
If I link to website with
<a href="//mywebsite.com"/>
It will send me to website if does or doesn't have SSL.
When clicking on link that is in this format, network tab reports status code 200 for that website, which means it is not redirection and it automatically goes to http
or https
.
My question here is how? It would be clear to me if it first tried http
and then redirected to https
, if it existed, but this is not the case.
Any ideas?
EDIT: Also, should this be used in web? Are there any consequences?