Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Names for types of URLs

Tags:

html

http

url

  1. Absolute
    http://www.example.com/images/icons.png

  2. Relative
    ../images/icons.png

  3. ???
    /images/icons.png

  4. ???
    //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.

like image 868
cherouvim Avatar asked Apr 13 '09 07:04

cherouvim


People also ask

What are the 5 URLs?

What are the parts of a URL? A URL consists of five parts: the scheme, subdomain, top-level domain, second-level domain, and subdirectory.

What are the 3 basic of URL?

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.

What are the name of URL?

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.


2 Answers

  1. Absolute http://www.example.com/images/icons.png
  2. Document-Relative ../images/icons.png
  3. Root-Relative /images/icons.png
  4. Protocol-Relative //www.example.com/images/icons.png

For #4, I've also often called them "Protocol-Agnostic"

like image 163
sjstrutt Avatar answered Oct 11 '22 02:10

sjstrutt


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.

like image 24
Alnitak Avatar answered Oct 11 '22 03:10

Alnitak