htmlcss

A fragment identifier is a short string of characters that refers to a resource that is subordinate to another, primary resource. The primary resource is identified by a Uniform Resource Identifier, and the fragment identifier points to the subordinate resource. Typically, the fragment identifier is appended to the Uniform Resource Locator (URL, a type of URI) for a hypertext document and is meant to identify a portion of that document.

A fragment identifier is defined by RFC 3986 as an optional component of a URI reference, and it must conform to a certain syntax. The syntax requires that the fragment identifier be separated from the rest of the URI reference by a

  1. (number sign or hash) character. The separator is not considered part of the fragment identifier.

Several proposals have been made for fragment identifiers for use with plain text documents (which cannot store anchor metadata), or to refer to locations within HTML documents in which the author has not used anchor tags:

  1. !s!search terms. The exclamation point is illegal in anchor tags, ensuring separation from that functionality. Adding a number after the s (
  2. !s10!) indicates that the browser should search for the nth occurrence of the search term. A negative number (
  3. !s-3!) starts searching backwards from the end of the document. A Greasemonkey script is available to add this functionality to compatible browsers.


This page uses Creative Commons Licensed content from Wikipedia (view authors).