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
1
vote
5 answers

Jquery - tell when the hash changes?

I'm trying to make my site respond correctly to the back button. I've saved that hash of what I want it to do, but I don't know the hook for jQuery to be able to tell when the hash changes. It's not .ready(), because the page doesn't reload. What…
Ethan
  • 5,660
  • 9
  • 44
  • 51
1
vote
3 answers

How can I jump to a point slightly above the fragment identifier?

I don't like how the fragment identifier jumps to the actual point of where the content begins on the page. It looks awkward having the box start right at the top of the screen. It kind of bugs me. So I was using an anchor with a name attribute…
animuson
  • 53,861
  • 28
  • 137
  • 147
1
vote
1 answer

Safe to have space in hash/URL fragment?

I'm writing a Javascript driven one-page application where the URL contains a # param eg. (example.com/#foo/bar) to represent application state (I've considered using various JS frameworks but cannot, due to various reasons). Sometimes, the hash may…
Jay
  • 3,471
  • 4
  • 35
  • 49
1
vote
1 answer

How to add URL fragment HtmlOutcomeTargetLink?

I would like to add an URL fragment #top to a HtmlOutcomeTargetLink, but cant figure out how. For an HtmlOutputLink I just use the following: HtmlOutputLink link = new HtmlOutputLink(); String urlWithFragment = url + "#top"; …
user1323246
  • 433
  • 2
  • 6
  • 23
1
vote
1 answer

Handling fragment identifiers during PHP redirects

I have searched around (SO and Google) and can't find any proper explanation of how other people handle this situation. In my application I am using PHP/Apache as a backend and Ben Alman's jQuery BBQ plugin for hashtag browser history. User logins…
Zappa
  • 453
  • 1
  • 5
  • 14
1
vote
1 answer

CSS select element based on fragment identifier in href attribute

I am using the tabview, which is part of the YUI3 library. The markup basically looks like this:
1
vote
0 answers

Issue with Fragment ID, App is crashing when loading the layout for the second time

Error inflating fragment for this same question, App is crashing when I click on the list item for the second time which is supposed to load the same layout second time also. Can anyone please help here.
ashu
  • 11
  • 2
1
vote
2 answers

How to get multiple values from jquery hash

How can i get multiple values in a jquery hash? Example: http://mysite.com/#l:value&v:id1212 same as but without page refresh http://mysite.com/?l=value&v=id1212 I thought something like: var hash = location.hash.replace(/^.*?#/, ''); var lVal =…
Kip
  • 478
  • 4
  • 13
0
votes
2 answers

handling multiple tabs with hashbang

I have a single page app that can have multiple tabs open with each tab doing different actions. if a user hits refresh or back, however, they lose everything they were working on. Is there a way, possibly with a combination of hash-bangs and…
LordZardeck
  • 7,953
  • 19
  • 62
  • 119
0
votes
2 answers

Understanding JQuery UI Tab control anchors

The jQuery UI Tab control is made up of a ul tag containing anchor links that represent the tabs. Normally clicking an anchor with a hash href will cause the hash fragment to be appended to the url in the address bar. So how come no hash fragment…
Yarin
  • 173,523
  • 149
  • 402
  • 512
0
votes
1 answer

Backbone state handling with nested models?

I'd like to manage all hash state attributes (#) in one Backbone model. StateModel //Pseudo attributes layout : string modelType1 : model modelType2 : model This way I could consistently update history entries just by serializing this…
dani
  • 4,880
  • 8
  • 55
  • 95
0
votes
1 answer

Why Firefox doesn't follow fragment identifiers in iframe?

Go to https://colnect.com/en/forum/app!/help/faq with Firefox, click any link and nothing happen. Do the same in Chrome and you will be moved somewhere. Is it Firefox issue or something else? Code is: The times are not…
Yuri
  • 313
  • 2
  • 9
0
votes
1 answer

HTML5 Jump to fragment but scroll slightly further (due to navigation bar)

I designed a page with a semi-transparent navigation bar at the top which is fixed to the top by using position: sticky & top: 0. It looks cool & works nice until I jump to a certain object by using the fragment in the URI (/page#obj-id) because it…
0
votes
2 answers

How to Read / Write or Preserve Fragment Identifiers on Post-back

I'm using fragment identifiers to run a tabbed browsing control and it would be nice if the post-back could preserve the tab as that is less jarring to the user. To that end I've been searching for a method to preserve the fragment identifier and am…
zellio
  • 31,308
  • 1
  • 42
  • 61
0
votes
1 answer

How to retrieve URL fragment identifier in JSP

Is there an easy way to get the URL fragment identifier (everything after the hash '#') in JSP? I've tried just finding even the URL itself which includes the fragment identifier with ${pageContext.request.queryString} and other similar…
at.
  • 50,922
  • 104
  • 292
  • 461