fragment-identifier

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? ...

List of valid characters for the fragment identifier in an URL?

I'm using the fragment identifier to create a permalink for AJAX events in my web app similar to this guy. Something like: http://www.myapp.com/calendar#filter:year/2010/month/5 I've done quite a bit of searching but can't find a list of valid characters for the fragment idenitifer. The W3C spec doesn't offer anything. Do I need to...

What's the shebang (#!) in Facebook and new Twitter URLs for?

EDIT [10/15]: added an example from the new Twitter too to make this question easier to search for. I've just noticed that the long, convoluted Facebook URLs that we're used to now look like this: http://www.facebook.com/example.profile#!/pages/Another-Page/123456789012345 As far as I can recall, earlier this year it was just a normal...

How to "bookmark" page or content fetched using AJAX?

How to "bookmark" page or content fetched using AJAX? It looks like it can be easy if we just add the details to the "anchor", and then, use the routing or even in PHP code or Ruby on Rails's route.rb, to catch that part, and then show the content or page accordingly? (show the whole page or partial content) Then it can be very simple...

Anchor not scrolling correctly

I have a layout something along the lines of : <div class="banner"></div> <div class="content"></div> My banner has position:fixed; and is roughly 200px high. The problem is that when I click a link with a fragment identifier, the page scrolls and the anchor (with the identifier) sits at the top of the page, behind the banner instead...

Stop loading of images on a hashchange event via JavaScript or jQuery

I am using the jQuery BBQ: Back Button & Query Library plugin to create a page that pulls in dynamic content when a link is clicked. When the link is clicked the hash is changed and new content is pulled in (the 'default' action of clicking a href is therefore disabled.) That part works just fine, but there is a problem. Example of my ...

How to show Ajax requests in URL?

What I want is to have links which change a part of the page , and a dynamic URL for it, where I can specify variables such like #calendar=10_2010tabview=tab2 Check this for an exact example: CLICK HERE FOR EXACT DEMO So here is the link format what I need: #calendar=10_2010&tabview=tab2 I need to have variables in the links like cal...

GWT - Parameters in Fragment

Hi. Here's my history value change event handler: public void onValueChange(ValueChangeEvent<String> event) { String token = event.getValue(); if (token != null) { if (token.equals("!list")) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { } ...

jquery and the # sybmol in the url (and ajax)

So I've got a simple page with different ways to filter the data (almost everything is working.) For example, you have a page with a list of the users. You can choose a page number, you can choose what to sort by (and what direction to sort in) and how many results per page. The way it works is whenever one of those variables are change...

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 not know there were anchors in the request: For example: 1) /user/profile#user/photos ...

When using Ajax History and Bookmark, is it always good to use "#!" instead of just "#"?

Facebook is doing Ajax History (Back and Forward button) and Bookmark using #! instead of just # in the URL. Is it always a good idea to do that, because I was thinking that a usual anchor could interfere with the Ajax History mechanism to trigger it into processing a normal anchor. So, the Ajax History function will only process a has...

Retrieve the fragment (hash) from a URL and inject the values into the bean

Hi! I am looking for a way to inject values from the fragment (#) of a URL into bean(JSF), in the same way query-parameter values are injected. I am using Ben Alman's Bookmarkable jQuery plugin (http://benalman.com/projects/jquery-bbq-plugin/) to create the URL fragments. I was hoping that Custom regex patterns from prettyFaces could be...

How do I use jQuery to create a bookmark-able hash?

I have a single URL i am using as an image gallery. At this URL is a thumbs div (i'm only showing four thumbs for the sake of brevity): <div id="thumbs"> <img src="graphics/thumbs/01.jpg" width="190" height="190" class="thumb objects" id="project01" /> <img src="graphics/thumbs/08.jpg" width="190" height="190" class="thumb web" id="pro...

jQuery "window.location.hash" - getting hash too late?

I'm working on some script but it have a serious problem with hashes. I have a list of link-images like: <a href="#1"><img src="1.jpg" /></a> <a href="#1"><img src="2.jpg" /></a> <a href="#1"><img src="3.jpg" /></a> All I want to do is to load file files/#1.html after clicking the first image, files/#2.html after the second etc. Her...

how facebook controls #! in url

how can i controls #! in url suppose i have the following url http://www.facebook.com/#!/video/video.php?v=1106030301789 now how facebook controls that #! in url.... ...

Why urllib2.urlopen can not open pages like "http://localhost/new-post#comment-29"?

I'm curious, how come I get 404 error running this line: urllib2.urlopen("http://localhost/new-post#comment-29") While everything works fine surfing http://localhost/new-post#comment-29 in any browser... urlopen method does not parse urls with "#" in it? Anybody knows? ...

Python Facebook Authentication Get Hashtag Info from modpython URL (google.com/search#thispart)

I am trying to authenticate facebook with my Python app and when you redirect a user to the authentication URL, it returns with the authentication key for that user. The return URL looks like this: http://blah.com/facebookauthenticate#access_token=appid|authtoken|othertoken&amp;expires_in=7064 I am returned a modpython request but i c...

How does facebook rewrite the source URL of a page in the browser address bar?

Go to http://www.facebook.com/facebook?v=wall, then click on the info tab. The content will be loaded, and the address bar now becomes http://www.facebook.com/facebook?v=info but the webpage didn't reload. At first I think it is Ajax, but my question is, how do you change the address bar without reloading? I know I can change anchor (#w...

URL Hash oddities

I've noticed some strange behaviour in JS window.location.hash = ''; var hash = window.location.hash; alert(hash + ' = ' + hash.length); //outputs: ' = 0' window.location.hash = '#'; hash = window.location.hash; alert(hash + ' = ' + hash.length); //outputs: ' = 0' window.location.hash = '_'; hash = window.location.hash; alert(hash + ' =...

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 URL fragment will be included in this or not. I have seen various behaviors in the wild so...