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

It’s using HTML5’s new history.pushState() feature to allow the page to masquerade as being at a different URL to that from which it was originally fetched. This seems only to be supported by WebKit at the moment, which is why the rest of us are seeing ?v=wall#!/facebook?v=info instead of ?v=info. The feature allows dynamically-loaded pages … Read more

Parsing URL hash/fragment identifier with JavaScript

Here it is, modified from this query string parser: function getHashParams() { var hashParams = {}; var e, a = /\+/g, // Regex for replacing addition symbol with a space r = /([^&;=]+)=?([^&;]*)/g, d = function (s) { return decodeURIComponent(s.replace(a, ” “)); }, q = window.location.hash.substring(1); while (e = r.exec(q)) hashParams[d(e[1])] = d(e[2]); return hashParams; … Read more

Handle URL fragment identifier (anchor) change event in Javascript

Google Custom Search Engines use a timer to check the hash against a previous value, whilst the child iframe on a seperate domain updates the parent’s location hash to contain the size of the iframe document’s body. When the timer catches the change, the parent can resize the iframe to match that of the body … Read more

Getting URL hash location, and using it in jQuery

Editor’s note: the approach below has serious security implications and, depending upon the version of jQuery you are using, may expose your users to XSS attacks. For more detail, see the discussion of the possible attack in the comments on this answer or this explanation on Security Stack Exchange. You can use the location.hash property … Read more

tech