Fragment identifier

from Wikipedia, the free encyclopedia

As a fragment identifier ( English fragment identifier ) is used in the information technology refers to a character string with which a subunit of a resource may be addressed.

Examples

Fragment identifiers are usually added to a URI (including a URL ) in order to address parts of a document. The fragment identifier is in this case with the double cross ( #in) in the URI. It is optionally at the end of a URI.

The interpretation of the fragment identifier depends on the type of resource and the parser . Examples:

  • In HTML, refers to the HTML element in document.html that contains the anchor (or ) attribute .http://example.com/document.html#anker1name="anker1"id="anker1"
  • In XML, it should be possible to use an XPointer that delivers all XML elements with the name "Camel" from the document.xml file as a result.http://example.com/document.xml#xpointer(//Kamel)
  • For PDF documents, see page 123 in document.pdf .http://example.com/document.pdf#page=123
  • A point in time, section or chapter can be specified for web videos and other audiovisual media. There are different pairings of keyword =value , where the keyword could be for example trackor tor also id. The required keyword as well as the interpretation of the assigned value depends on the type of medium. So should jump to the 40th second of the video .http://example.com/video.mp4#t=40video.mp4

The Scalable Vector Graphics (SVG) specification allows access to different elements within the same vector graphic using fragment identifiers. This makes it possible, for example, to keep different icons of a graphical user interface in a common SVG file and, if necessary, to reference only the desired icon. In this case too, the fragment identifier is separated from the name of the resource by a hash sign, but does not have to be part of a URI.

use

Traditionally, browsers do not transmit a fragment identifier with the query to the server , but request the entire document and download it. You display it in full and then jump to the desired location.

syntax

The double cross itself does not belong to the fragment identifier, only the part after it.

According to RFC 2396 Section 4.1 in conjunction with Section 2, fragment identifiers are subject to the same restrictions as URIs, i.e. they must not contain spaces , percent signs, another "#" or other characters that are not permitted in URIs.

The identifiers must be clearly assigned within a document. You have to identify unequivocally which element is meant and cannot appear repeatedly with the same identifier.

Web links

Individual evidence

  1. w3.org
  2. How SVG Fragment Identifiers Work. November 3, 2014, accessed January 16, 2019 .