docs.rodeo

MDN Web Docs mirror

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

#fragment

Description

Consider the following URL:

http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument

#SomewhereInTheDocument is the fragment of the URL, which is an anchor to another part of the resource itself. An anchor represents a sort of “bookmark” inside the resource, giving the browser the directions to show the content located at that spot. In an HTML document, for example, the browser will scroll to the point where the anchor is defined. It can be the id attribute of an element, and the browser will scroll to that element In a video or audio document, it can be a media fragment in the form of #t=..., which makes the video or audio start playing from that time.

There’s a special text fragment feature that allows you to link to a specific part of a web page identified by its text content.

Examples

Specifications

{{Specifications}} 

See also

In this article

View on MDN