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
1 answer

Hash retrieval from URL

I am trying to setup a form which grabs the hash from the url, then uses that value to determine what radio inputs to check. The latter part is working, but i cannot get the hash retrieval to work. var url = document.referrer; var dec=…
Jake6192
  • 13
  • 5
1
vote
1 answer

any way to invoke fragment identifiers '#' in python

Is there any way to invoke fragment identifiers from python? I'm currently using python mechanize.
prostock
  • 9,327
  • 19
  • 70
  • 118
1
vote
1 answer

How do I approach changing URL's on a long scroll page?

I have been tasked with creating one long page that will have various small articles for the user to scroll through. Each of the article sections have a category and I need for the URL to reflect that category being viewed. I am aware that…
cwal
  • 3,732
  • 3
  • 19
  • 20
1
vote
2 answers

OpenURI having issues when passed URLs with fragment identifiers

I have a requirement to read a series of URLs from a text file and then retrieve the pages and output a list of links. The code has issues whenever the input URLs contain fragment identifiers (#). I tried escaping these with %23 but this didn't seem…
1
vote
1 answer

Hiding the hash location in JavaScript

I have a page with links that open a modal with id="modal-i (where i is any number) linked to an anchor tag with href="#modal-i". This works fine, you click the link and the associated modal will pop up, then when a link with href="#" is clicked the…
Sam Chahine
  • 530
  • 1
  • 17
  • 52
1
vote
2 answers

Scroll to anchor onload with header offset

I'm using anchors on my website with several divs. When my page loads, I have a # at the end of my URL like this: http://www.website.com/projects#third I also have a fixed header, with 100px height. I'm using scrollto plugin. What I'm trying to do…
mmdwc
  • 1,095
  • 6
  • 27
  • 53
1
vote
1 answer

Ajax #anchors processing with MVC

I am looking to standardize the processing of ajax #anchors at the server side, using MVC. Before a controller action is invoked I want to convert every request with ajax anchors into a request without ajax anchors, so that the controller code does…
Andy
  • 2,670
  • 3
  • 30
  • 49
1
vote
2 answers

using URL hashes in javascript AND anchors

We're using URL hashes in some places in our app to filter the display, e.g. #highlight=free will highlight our free content. We use javascript to process the hash, listen to hash changes. All works great. We're wondering however about the best way…
gingerlime
  • 5,206
  • 4
  • 37
  • 66
1
vote
1 answer

Google OAuth service redirects to URL with a # sign at the end

When the user is redirected to https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=[clientid]&redirect_uri=http://example.com/googleauth&scope=email by our "Sign In with Google" button, the response's Location header that causes…
SeinopSys
  • 8,787
  • 10
  • 62
  • 110
1
vote
3 answers

taking the # out of url on location.hash

function updateView(category) { console.log( window.location.hash ); if (location.hash !== ""){ //convert #3 to 3. //load video based on id //myArray[sanitizedHash]; } else { updateCategoryLabel(category); currentList =…
h0bb5
  • 609
  • 1
  • 7
  • 22
1
vote
2 answers

Redirect url to # (anchor)

I have a site that I just converted to use anchor navigation.. hwww.site.com/shows is now www.site.com/#shows It loads the info from the /shows directory to a div and adds the hash tag to tell you where you are. The problem is, if you go to…
1
vote
1 answer

IE8+, window.open(url/#/frag,'_parent') vs. parent.location.href=url/#/frag in iframe

I have a site that loads an iframe. Code in the parent window registers an onbeforeunload listener. Currently the iframe contains a button with a click handler that fires off: window.open(/#/frag,'_parent') In all browsers I have tested (besides…
mjj1409
  • 3,075
  • 6
  • 28
  • 28
1
vote
1 answer

How to get back button to work with anchors (#) and iframes

I am working on a site where the main part of it is driven by an ajax style navigation system using anchors in the url to define the application state. On top of this I now need to support IFrames that are loaded on top of this application. The…
ed.
  • 2,696
  • 3
  • 22
  • 25
1
vote
4 answers

When the url hash match a div's id then do something to the child of the div

Let's say I have the html as below:
AAAA
BBBB
CCCC
1
vote
2 answers

Generating a link containing a fragment with ASP.Net MVC Routelink

I'm trying to use Html.RouteLink within a view to generate a link to a named anchor on another page. There's a few definitions for RouteLink that include a fragment option but I'm trying to figure out if there's another way. public static string…
Tivac
  • 2,553
  • 18
  • 21