简体   繁体   中英

What's the difference between // and http or https

I could only find answers about http and https comparison but I would like to ask: Is there any difference if I will use in code // rather than https:// ? (In addition to reducing the code)

For example:

<a href="//website.com">test></a>

And:

<a href="https://website.com">test></a>

In a URL, // means "current protocol"; either http or https depending on which you're currently using.

Just to be crystal clear, the difference between using // rather than https:// is that the second specifies the protocol (https), whereas the first uses the current protocol (which could be http or https , like wizzwizz4 answered). See this question for more details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM