Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. URIs
  3. Reference
  4. Fragment

URI fragment

Thefragment 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.

Description

Consider the following URL:

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

#SomewhereInTheDocument is thefragment 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 theid attribute of an element, and the browser will scroll to that elementIn a video or audio document, it can be amedia fragment in the form of#t=..., which makes the video or audio start playing from that time.

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

Examples

#syntax

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

#:~:text=fragment

The browser will highlight the textfragment 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

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp