fragment-identifier
How to access url hash/fragment from a Django Request object
This is not sent to the server, by definition. From URI References: Fragment Identifiers on URIs : “The HTTP engine cannot make any assumptions about it. The server is not even given it.”
Smooth scroll to anchor after loading new page
As browsers automatically detect the hash and take you to that position… It occurs to me that you could first reset the scroll position to 0 and then made the smooth scrolling. Something like… // to top right away if ( window.location.hash ) scroll(0,0); // void some browsers issue setTimeout( function() { scroll(0,0); }, 1); … Read more
Why does Twitter use a hash and exclamation mark in URLs, and how do they rewrite search URLs?
It’s become the de facto standard that Google has established to ensure consistency and make ajax urls crawlable. See http://code.google.com/web/ajaxcrawling/docs/getting-started.html I believe they are using history.pushState. You can do history.back() in the console and it’ll lead you back to the page.
Maximum length of URL fragments (hash)
The hash is client side only, so the rules for HTTP may not apply to it.
What are the differences between history.pushState & location.hash? [closed]
location.hash has a better support than the history.pushState method. The advantage of the pushState method is that you can bind a state to the history entry. If you don’t need this state object, I recommend to use the location.hash property, to have better compatibility with older browsers. location.hash=”new-hash”; console.log(history.state); // null or undefined history.pushState({extraData: “some … Read more
Encoding of window.location.hash
Unfortunately, this is a bug in Firefox as it decodes location.hash an extra time when it is accessed. For example, try this in Firefox: location.hash = “#%30”; location.hash === “#0”; // This is wrong, it should be “#%30” The only cross-browser solution is to just use (location.href.split(“#”)[1] || “”) instead for getting the hash. Setting … Read more
Remove fragment in URL with JavaScript w/out causing page reload
As others have mentioned, replaceState in HTML5 can be used to remove the URL fragment. Here is an example: // remove fragment as much as it can go without adding an entry in browser history: window.location.replace(“#”); // slice off the remaining ‘#’ in HTML5: if (typeof window.history.replaceState == ‘function’) { history.replaceState({}, ”, window.location.href.slice(0, -1)); }
changing location.hash with jquery ui tabs
In your event handler function ui.tab is an anchor element. You can retrieve its hash value like this: $(“#tabs > ul”).tabs(); $(“#tabs > ul”).bind(“tabsshow”, function(event, ui) { window.location.hash = ui.tab.hash; }) Does this work for you?