Jekyll One

QuickSearch

  • Home
  • Series
  • Previous
  • Last

2023 October, 18

Series Elements

This is part 1 in a 4-part series:

  • 2023-10-18 · Part 1 · URLs
  • 2022-02-01 · Part 2 · J1 Theme
  • 2021-02-01 · Part 3 · Site Generators
  • 2021-01-01 · Part 4 · Cookies
Protocol scheme

What is the difference between the URLs https://domain and //domain?

What is the difference between the URLs https://domain and //domain?

2 Minutes to read

The primary difference is that https://domain specifies the protocol HTTPS explicitly, while //domain inherits the protocol from the current webpage. Using //domain is a good practice to maintain consistency with the current page’s protocol and reduce potential security issues related to mixed content.

Absolute URL

URLs of type https://domain are absolute URLs, meaning they explicitly include the protocol or scheme — in this case https://. When you use this format, you specify that the website should be accessed over HTTPS, a secure protocol for web communication. The browser will use the HTTPS protocol to connect to the specified domain.

Protocol-relative URL

URLs of type //domain are protocol-relative URL or network-path references. It does not explicitly specify a particular protocol as HTTP or HTTPS. Instead, it inherits the protocol used in the current webpage.

If the current webpage is loaded over HTTPS, the browser will use HTTPS to connect to the domain. If the current webpage is loaded over HTTP, it will use HTTP. Protocol-relative URLs often ensure that resources are loaded securely when a webpage can be accessed over HTTP and HTTPS without causing mixed content issues (for example loading insecure resources on a secure page).