URL (source code)

= URL
{c}

A <URL>, or Uniform Resource Locator, is a structured identifier interpreted according to a <URL scheme> and parsing rules. On the web it can identify the resource a browser navigates to or requests. The <URL parser> produces a record with components such as scheme, host, port, path, query and fragment; which components are present depends on the particular URL.<URL Standard by WHATWG>[§4, URL representation, writing and parsing]{ref}

For example, `https://example.org:8443/a/b?x=1#part` has scheme https, host example.org, port 8443, path /a/b, <query string> x=1 and <fragment identifier> part. This hierarchical HTTPS example is useful without implying that every URL must contain a network host or an explicit port.

A <Relative URL reference> needs a base. Resolving `../img/p.png` against `https://example.org/a/b/page.html` gives `https://example.org/a/img/p.png`. The base's directory and parent-directory step explain the result. Parsing and serialization can also normalize a spelling: `https://EXAMPLE.org:443/a` serializes as `https://example.org/a`, lowercasing the host and omitting the default HTTPS port.<URL Standard by WHATWG>[URL parsing and serializing algorithms; §6.1, URL constructor with a base]{ref}

<Percent-encoding> represents bytes in a URL spelling, and encoded data must be distinguished from structural delimiters. A <query string> is not universally a dictionary of name/value pairs, even though many applications use that convention. Nor does successful parsing prove that a resource is reachable or that its content never changes. Distinguishing syntax, identifier interpretation and an actual retrieval prevents an address from being confused with the information returned on one occasion.