URI Fragment Identifiers


URI Fragment Identifiers, as defined in RFC 3986, as:

The fragment identifier component of a URI allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information.

The identified secondary resource may be some portion or subset of the primary resource, some view on representations of the primary resource, or some other resource defined or described by those representations.

URI Fragment Identifiers component is indicated by the presence of a number sign ("#") character and terminated by the end of the URI.

When a URI reference refers to a URI that is, aside from its URI Fragment Identifiers component (if any), identical to the base URI (Section 5.1), that reference is called a "same-document" reference. The most frequent examples of same-document references are relative references that are empty or include only the number sign ("#") separator followed by a fragment identifier.

URI Fragment Identifiers holds additional identifying information that provides direction to a secondary resource, e.g., a section heading (in an article) identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an id attribute of a specific element and web browsers will make sure this element is visible.

RFC 7320#

Media type definitions (as per RFC 6838) SHOULD specify the fragment identifier syntax(es) to be used with them; other specifications MUST NOT define structure within the URI Fragment Identifiers, unless they are explicitly defining one for reuse by media type definitions.

For example, an application that defines common fragment identifiers across media types not controlled by it would engender interoperability problems with handlers for those media types (because the new, non-standard syntax is not expected).

More Information#

There might be more information for this subject on one of the following: