URI fragment

The fragment of a URI is the last part of the URI, starting with the # character. It is used to identify a specific part of the resource, such as a section of a document or a position in a video. The fragment is not sent to the server when the URI is requested, but it is processed by the client (such as the browser) after the resource is retrieved.

Syntax

url
#fragment
fragment

A sequence of any characters. The exact format of the fragment is defined by the resource itself. Some common examples:

  • In an HTML document, it can be the id attribute of an element, and the browser will scroll to that element.
  • It can be a text fragment in the form of #:~:text=..., which makes the browser highlight the specified text.
  • It can be a media fragment in the form of #t=..., which makes the video or audio start playing from that time.

Examples

#syntax

The browser will scroll to the element with the id="syntax" in the document (which, for this page, is the Syntax heading).

#:~:text=fragment

The browser will highlight the text fragment in the document.

#t=10,20

The video or audio will start playing from the 10th second.

Specifications

Specification
Unknown specification
# section-3.5

See also