Absolutehttp://www.example.com/images/icons.png
Relative../images/icons.png
???/images/icons.png
???//www.example.com/images/icons.png
Do URL types 3 and 4 have names? One place I've seen type 4 being used is on Slashdot.
What are the parts of a URL? A URL consists of five parts: the scheme, subdomain, top-level domain, second-level domain, and subdirectory.
To recap, these are the three basic elements of a website URL: The protocol – HTTP or HTTPS. The domain name (including the TLD) that identifies a site. The path leading to a specific web page.
A URL (aka Universal Resource Locator) is a complete web address used to find a particular web page. While the domain is the name of the website, a URL will lead to any one of the pages within the website.
For #4, I've also often called them "Protocol-Agnostic"
Type 1 is just a "URI" (sometimes called an "absolute URI").
For types 2, 3 and 4 the definitive answers are in RFC 3986, section 4.2.
They are all "relative references", but according to the RFC are qualified thus:
../images/icons.png
- "relative path reference"/images/icons.png
- "absolute path reference"//
.../icons.png
- "network path reference"The latter is often used if you want to specify a URL containing a domain name, but where you want the protocol to match the protocol used to access the current resource. For example, if your images are downloaded from a CDN, you could use this to default to https
if the current page was also downloaded via https
, thus preventing the warning about including non-secure resources in a secure page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With