= URL record
{c}
A <URL record> is the structured internal representation of a <URL>, rather than its original text. The <URL parser> produces components such as scheme, host, port, path, <query string> and <fragment identifier>; <URL serialization> turns the record into a string. A component can be absent, and the representation of a path depends on the scheme.<URL Standard by WHATWG>[Section4.1, URL representation: record fields and path types]{ref}
Parse `https://example.org:8443/a?x=1#part`. The host is `example.org`, the port is 8443, the path contains `a`, the query is `x=1`, and the fragment is `part`. The separators `?` and `#` belong to the serialized syntax, rather than the stored query and fragment values. These fields let a program change one component without guessing its boundaries by cutting an arbitrary string.
The original spelling need not survive. Parsing `https://EXAMPLE.org:443/a` yields a lowercased host and no stored explicit port, because 443 is the scheme default. Therefore the record does not contain a faithful log of every character supplied by the user. If an application needs that log, it must retain the input separately.<URL API in the Node.js documentation>[URL constructor, hostname, port and href: parsed component access]{ref}
Back to article page