fragment-identifier

Apache rewrite rule for a destination containing a hash mark

爷,独闯天下 提交于 2019-12-03 22:39:43
I'm trying to issue a redirect where the destination contains a fragment-identifier part. I tried with this rule: RewriteRule ^/foo/bar/([^/]+)/(.*)$ /cgi/script#foobar::$1.$2 [R,L] However the # is converted into %23 and the web application cannot correctly parse this url. How can I force apache to keep the # character ? Solution found: there is an option for not escaping urls with mod_rewrite: https://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_ne Adding the [NE] flag solved the problem. 来源: https://stackoverflow.com/questions/9993017/apache-rewrite-rule-for-a-destination-containing-a

Is it possible to target “no target” in CSS?

独自空忆成欢 提交于 2019-12-03 22:14:03
问题 Is there a css selector for "no fragment identifier present"? The opposite of :target . The thing is, I'm making a document where different parts of it are visible depending on which fragment identifier you give it. Think of it as a sprite file, only for HTML. So it looks like this <style> section {display:none} section:target {display:block} </style> <body> <section id="one">The first block (showing with #one)</section> <section id="two">The second block (showing with #two)</section>

How to “bookmark” page or content fetched using AJAX?

天涯浪子 提交于 2019-12-03 14:35:59
问题 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? It looks like that's how facebook does it. What are other good ways to do it? 回答1: Update: There is now the HTML5 History API (pushState, popState) which

Get the hashchange event to work in all browsers (including IE7)

☆樱花仙子☆ 提交于 2019-12-03 03:13:34
问题 I have some code (written by another developer) that is doing AJAX page loading inside of WordPress (e.g. no page reloads) when you click a nav item, AJAX refreshes the primary content area. My problem is that it's broken in IE7 and I have no idea where to start in terms of debugging. The original opening lines were var queue = 0; $('document').ready(function() { window.addEventListener("hashchange", hashChange, false); // Define window location variables var windowHost = window.location.host

Get the hashchange event to work in all browsers (including IE7)

谁说胖子不能爱 提交于 2019-12-02 15:17:14
I have some code (written by another developer) that is doing AJAX page loading inside of WordPress (e.g. no page reloads) when you click a nav item, AJAX refreshes the primary content area. My problem is that it's broken in IE7 and I have no idea where to start in terms of debugging. The original opening lines were var queue = 0; $('document').ready(function() { window.addEventListener("hashchange", hashChange, false); // Define window location variables var windowHost = window.location.host, windowHash = window.location.hash, windowPath = window.location.pathname; But I changed them to make

“/#action” Route in Routes.rb in Ruby on Rails

不打扰是莪最后的温柔 提交于 2019-12-01 15:10:34
How can I create a route of this format (in Ruby on Rails routes.rb file): /#action/id Specifically with the "#" character inserted before the action controller...for example, see http://lala.com/#album/some-album-id thanks! The actual URL you are visiting there is http://lala.com/ . The server does not see the #album/some-album-id piece, the fragment identifier . That is seen solely by the browser. There is a growing trend of building MVC apps with the views and controllers in the client/browser, rather than on the server. The application is implemented with JavaScript in the client, instead

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

江枫思渺然 提交于 2019-12-01 08:52:58
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? Oh yes - it's becoming a common pattern to handle page-state-to-URL persistence when content is AJAX driven. Javascript can access this value via window.location.hash. Once that's done, you can perform any actions based on the value of that hash Show/hide nodes Makes other AJAX calls Change page titles or colors Swap images

Url fragment and Referer header

独自空忆成欢 提交于 2019-12-01 03:21:00
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 this might be browser-specific. Does anyone know which browsers do what? And what does the HTTP spec say on this? The spec says that Referer can't include a fragment identifier (per ABNF). See RFC 2616, Section 14.36 . I saw the same behavior in IE today. I am

JavaScript/jQuery - onhashchange event workaround

时间秒杀一切 提交于 2019-11-30 20:19:47
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? Not sure if this is what you're looking for or not but worth a try: http://plugins.jquery.com/project/ba-jquery-hashchange-plugin Yes there is. Check out this jQuery plugin: http://benalman.com/projects/jquery-hashchange-plugin/ var lastHash = ""; window.onload=function() { hashChangeEventListener = setInterval("hashChangeEventHandler()", 50); } function hashChangeEventHandler() { var newHash = location.hash.split('#')[1]; if(newHash != lastHash) {

Jquery - tell when the hash changes?

点点圈 提交于 2019-11-30 16:29:20
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 someone clicks a link. It's on the same subdomain, so i'm able to see it's filepath, and am saving it so you can bookmark. Unfortunately by saving it as a hash, my back button now fails to reload, which fails to reload the iframe, so my back button is essentially broken. If