!!! Overview [{$pagename}] (or sometimes also called [Same-Document Reference] or anchor tag) are anything past the first "#" within the [URI] (or [URL]) [{$pagename}] is interpreted __only__ by the local web [browser] and is typically __NOT__ passed to the remote web [server]. !! [{$pagename}], as defined in [RFC 3986], as: ''The fragment identifier component of a URI allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. The identified secondary resource may be some portion or subset of the primary resource, some view on representations of the primary resource, or some other resource defined or described by those representations. [{$pagename}] component is indicated by the presence of a number sign ("#") character and terminated by the end of the [URI]. '' \\ ''When a [URI] reference refers to a [URI] that is, aside from its [{$pagename}] component (if any), identical to the base [URI] (Section 5.1), that reference is called a "same-document" reference. The most frequent examples of same-document references are relative references that are empty or include only the number sign ("#") separator followed by a fragment identifier. [{$pagename}] holds additional identifying information that provides direction to a secondary resource, e.g., a section heading (in an article) identified by the remainder of the [URI]. When the primary resource is an HTML document, the fragment is often an id attribute of a specific element and web browsers will make sure this element is visible. '' !! Anything After the First "#" is a Fragment Identifier [2] Even if the first # appears to be contained within the host name, path or [URI Query] string – "#" always indicates where the [{$pagename}] starts. For [example], here’s a [URL] that __attempts__ to encode an HTML color and shape into the [URI Query] string: %%prettify {{{ http://example.com/?color=#ffff&shape=circle }}} /% Unfortunately, the "#" in the HTML color makes the rest of the URL a fragment identifier and the server will see a single, empty color parameter in the query string. ! Changing A [{$pagename}] Doesn’t Reload a Page but Does Create History Fragments have a couple of handy features. First, if you manually change a fragment URL from something like this: %%prettify {{{ http://www.httpwatch.com/features.htm#filter }}} /% to this: %%prettify {{{ http://www.httpwatch.com/features.htm#print }}} /% and the [browser] scrolls the page to the new location but does not reload the page. However, it does add an entry in the [browser]’s history so that clicking the Back button will go back to the original location in the page. These features are particular useful when used with Javacript to create linkable [URLs] and history for pages that either use top level HTML frames or update their content dynamically with [AJAX] calls. ! [{$pagename}] Are not Sent in [HTTP Request] Messages If you try using fragment URLs in an [HTTP] sniffer like HttpWatch, you’ll never see the [{$pagename}]s in the requested [URL] or Referer header. The reason is that the [{$pagename}] is only used by the browser – it doesn’t affect which resource is returned from the server. So do not expect to see [{$pagename}] in your [Server-side] code. !! [RFC 7320] Media type definitions (as per [RFC 6838]) [SHOULD] specify the fragment identifier syntax(es) to be used with them; other specifications [MUST NOT] define structure within the [{$pagename}], unless they are explicitly defining one for reuse by media type definitions. For example, an application that defines common fragment identifiers across media types not controlled by it would engender interoperability problems with handlers for those media types (because the new, non-standard syntax is not expected). !! [{$pagename}] [Security Considerations] * [Covert Redirect Vulnerability] !! More Information There might be more information for this subject on one of the following: [{ReferringPagesPlugin before='*' after='\n' }] ---- * [#1] - [Fragment_identifier|Wikipedia:Fragment_identifier|target='_blank'] - based on information obtained 2017-07-19- * [#1] - [6 Things You Should Know About Fragment URLs|https://blog.httpwatch.com/2011/03/01/6-things-you-should-know-about-fragment-urls/|target='_blank'] - based on information obtained 2017-07-19-