fragment-identifier

Detecting Back Button/Hash Change in URL

I just set up my new homepage at http://ritter.vg. I'm using jQuery, but very minimally. It loads all the pages using AJAX - I have it set up to allow bookmarking by detecting the hash in the URL. //general functions function getUrl(u) { return u + '.html'; } function loadURL(u) { $.get(getUrl(u), function(r){ ...

Remove fragment in URL with JavaScript w/out causing page reload

Background: I have an HTML page which lets you expand certain content. As only small portions of the page need to be loaded for such an expansion, it's done via JavaScript, and not by directing to a new URL/ HTML page. However, as a bonus the user is able to permalink to such expanded sections, i.e. send someone else a URL like http://e...

How can you check for a #hash in a URL using JavaScript?

Hi, I have some jQuery JavaScript code that I want to run only when there is a hash (#) anchor link in a URL. How can you check for this character using JavaScript? I need a simple catch-all test that would detect URLs like these: example.com/page.html#anchor example.com/page.html#anotheranchor Basically something along the lines of...

.htaccess redirect with fragment

I need to issue a redirect, using .htaccess, to a URL with a fragment (also known as an anchor), but it's automatically escaping the #. At the moment I want a hard-coded fragment, but for the sake of others if you know how to take it from the URL too that would be good. Ideally I should be able to use QSA as well. For example: http:/...

Does the IE url length limit apply to content after the "#"?

I have seen many places that IE limits urls to 2000 or so characters in length. I can't figure out, though, does this apply to the portion after the # as well? That part isn't sent to the server so it seems like it might be different. ...

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 problem. the main frame.... frame.html is <html><head> <frameset rows="*"> <frame src=se...

On - window.location.hash - change?

I am using Ajax and hash for navigation. Is there a way to check if the window.location.hash changed like this? http://example.com/blah#123 to http://example.com/blah#456 It works if i check it when the document loads. But If I have #hash based navigation it doesnt work when I press the back Button on the browser (so I jump from blah#4...

Do hashes in URLs affect SEO?

If I've got 2 (or more) URLs (where the only difference is the hash value) to my homepage will Google divide my page rank between those pages or is it 'safe' to have lots of different hashes in the URL and still keep one page rank? Example: http://example.com/ http://example.com/#hash ...

Redirect/Refresh to fragment identifier

Im using the iUI framework to create a site. If your not familiar with this you have one page made up of divs and you navagate the user between with fragment identifiers. The problem with this is if your user adds content it is not visible until they refresh. In my sistuation they add data to a list via jquery post but like I say they ...

Could a page display diferrent content if the URL hash changes?

How could a page display different content based on the URL hash? I'm not talking about the browser scrolling down to display the anchored section, but something like JavaScript reacting to that hash and loading different content via AJAX. Is this common or even probable? ...

How can an iframe change its parent's URL fragment (without causing a refresh)?

I'm trying to get a child JavaScript application to update it's parent document. In essence, this is a very simple problem: a JavaScript program opens an iframe in it's own document. another JavaScript program is loaded into the iframe. the second program needs to change the fragment (anchor) in the original page. the first program, t...

Keeping history of hash/anchor changes in JavaScript

I'm currently implementing a JavaScript library that keeps track of the history of changes to the hash part in the address bar. The idea is that you can keep a state in the hash part, and then use the back button to go back to the previous state. In most of the recent browsers, this is automatic and you only have to poll the location.ha...

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 variable. http://www.example.com/#location However, discussion at this link indicates that the fragment of a URL is o...

How can a URL fragment affect a CSS layout?

Compare these 3 URLs (look at the top navigation bar in each case): http://fast.kirkdesigns.co.uk/blog as above but with the url fragment #navigation as above but with the url fragment #node-2655 Note, that the only difference is the URL fragment on the end. The first two pages display absolutely fine (in Firefox at least). It's the...

Storing Data in URIs After Hash

I want to store key/value pairs in URI's after the hash for use on the client side like so: http://www.foo.com/index.html#foo=bar&amp;baz=quux Is there a pre-existing solution that already does this or should I roll my own? I'm already using JQuery so a JQuery solution would be particularly welcome. My original idea was to use a reg...

Jquery - tell when the hash changes?

Hey SO, 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 do I use? Edit for a bit of clarity: I'm using an iframe, so I can't tell when...

jquery history plugin

I am using this plugin: http://plugins.jquery.com/project/history on this page: http://www.crtaci.info/index.php?autocom=majice I dont know why but it seems i cant figure out what to do to get this to work... Guess i need more sleep... :) ...

Modifying document.location.hash without page scrolling

We've got a few pages using ajax to load in content and there's a few occasions where we need to deep link into a page. Instead of having a link to "Users" and telling people to click "settings" it's helpful to be able to link people to user.aspx#settings To allow people to provide us with correct links to sections (for tech support, et...

max length of url hash parameter

Is there a limit of the length of an url hash parameter ...

Make Firefox refresh after changing fragment from an iframe

My code is in an iframe from a different domain, and I want to trigger a page refresh on the parent after changing the fragment of the URL (also of the parent). It happens on IE, but not on Firefox. Is there any way of doing it without changing the outer document (polling e.g.)? <a href="http://top.domain.com/#fragment" target="_top">c...