Questions tagged [fragment-identifier]

The fragment-identifier is the part of the URI/URL following the hash symbol. In the case of `http://mysite.com/page/#/one` then `/one` would be the fragment-identifier.

The fragment-identifier is the part of the URI/URL following the hash symbol. In the case of http://mysite.com/page/#/one then /one would be the fragment-identifier.

In URIs a hashmark # introduces the optional fragment near the end of the URL. The generic RFC 3986 syntax for URIs also allows an optional query part introduced by a question mark ?. In URIs with a query and a fragment, the fragment follows the query. Query parts depend on the URI scheme and are evaluated by the server — e.g., http: supports queries unlike ftp:. Fragments depend on the document MIME type and are evaluated by the client (Web browser). Clients are not supposed to send URI-fragments to servers when they retrieve a document, and without help from a local application (see below) fragments do not participate in HTTP redirections.

A URI ending with # is permitted by the generic syntax and could be considered as a kind of empty fragment. In MIME document types such as text/html or any XML type, empty identifiers to match this syntactically legal construct are not permitted. Web browsers typically display the top of the document for an empty fragment.

The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the web server — of course the server typically helps to determine the MIME type, and the MIME type determines the processing of fragments. When an agent (such as a Web browser) requests a web resource from a Web server, the agent sends the URI to the server, but does not send the fragment. Instead, the agent waits for the server to send the resource, and then the agent processes the resource according to the document type and fragment value.

For more info see wiki.

243 questions
12
votes
8 answers

Preventing scroll when using URI hash to identify tab

I'm using JQuery UI to make tabs in my application. I needed the tabs to be linkable (direct link that opens the page and selects the correct tab). This is done by using a hash tag/fragmented identifier. But I have a issue when the content above the…
HNygard
  • 4,526
  • 6
  • 32
  • 40
12
votes
3 answers

Url fragment and Referer header

Imagine you are on a page whose URL has a fragment (the part after the #), and click a link to go to another page. Most browsers will send the URL of the original page to the server in the Referer header. What I want to know is whether or not the…
levik
  • 114,835
  • 27
  • 73
  • 90
10
votes
4 answers

How to read the #hash (or fragment identifier) of the current page URL?

If I am on https://www.website.com/#something, how can I return the hash value "something" from the URL?
user1661548
9
votes
1 answer

Multiple fragment identifiers correct in URL?

I stumbled across a site that uses multiple fragment identifiers in their URLs, like http://www.ejeby.se/#newprodukt#produkt#1075#1 (no, it is not my site, but I am linking to it, which brings problems for me). But is this really correct? It does…
Johan
  • 1,292
  • 1
  • 13
  • 15
9
votes
5 answers

Are there two ways to jump to a fragment identifier in HTML?

I always thought the standard way to specify a fragment identifier is by . go to foo

some content under that anchor with…

nonopolarity
  • 146,324
  • 131
  • 460
  • 740
8
votes
1 answer

Use of /#/ in the middle of a URL

I recently came across a web application whose URLs have the form: https://URL.com/page/uuid/#/anotheruuid/area?action=whatever I am confused as to the use of # in the URL. Usually, the pound symbol is reserved for fragment identifiers, which go at…
8
votes
5 answers

Prevent window.onhashchange from executing when hash is set via JavaScript

I use the window.onhashchange function to execute code when the User changes the hash of the page: window.onhashchange = function() { /* do something */ }; In some functions I also set the hash via JavaScript: window.location.hash = "#abc"; I want…
Preli
  • 2,953
  • 10
  • 37
  • 50
8
votes
5 answers

PHP & Hash / Fragment Portion of URL

I am trying to find a way to save the hash portion of a url and as a PHP variable. This idea is a bit kooky, but bear with me... I'd like to extract the "location" fragment from the following URL and save it as a PHP…
mikey_w
  • 1,747
  • 3
  • 13
  • 12
8
votes
1 answer

Why does Wikipedia use a modified percent encoding in their URL fragments?

I noticed that Wikipedia uses percent encoding for the path section of a URL, but converts the % character to . for the #fragment. For example, on the Russian 'Russia' page, the URL for section 2 (История)…
Deebster
  • 2,829
  • 1
  • 26
  • 26
7
votes
0 answers

Fragment identifier (#) in Uri not working correctly

I'm using the following code to open the browser to a specific section of a webpage: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://something.somewhere.com/baggage_fees.html#_" + twoLetterCode; …
PaulG
  • 6,920
  • 12
  • 54
  • 98
7
votes
6 answers

JavaScript/jQuery - onhashchange event workaround

Until all browsers support the onhashchange event what is the best workaround for this? Is there something for this in jQuery? or as a plug-in?
MJLefevre
  • 815
  • 1
  • 8
  • 15
6
votes
2 answers

Using hash tags with Facebook share possible?

I'm developing an ajax based web site and I want to include a FB share function on the loaded content. The links use a hash tag and I can't manage to get the full links to show up when using the share function, I only get the domain url. Are hash…
Staffan Estberg
  • 6,795
  • 16
  • 71
  • 107
6
votes
1 answer

Why is same-document reference in SVG affected by HTML tag?

I have an HTML page with a tag, also containing SVG. Same-document references such as the below within the SVG then fail:
user663031
6
votes
7 answers

Setting location.hash in frames

I am using ajax to update the location of a page in a frame. But when setting the location of the hash (on Chrome and some versions of IE (5.5) specifically, but occasionally on IE7) the page is being reloaded. The following html demonstrates the…
Dave
  • 197
  • 1
  • 2
  • 7
6
votes
3 answers

Triggering click on a link doesn't change location hash

I'm working on a web application that uses onHashChange event listener in some situations and manually clicking on a link with href="#hash" works perfectly well. But when I trigger click on the same link using jQuery's…
Farid Rn
  • 3,167
  • 5
  • 39
  • 66