fragment-identifier

PHP & Hash / Fragment Portion of URL

牧云@^-^@ 提交于 2020-01-19 03:28:26
问题 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 only reachable through JavaScript. But would it be possible to create a link where the fragment is duplicated in the URL, parsed by PHP, and then removed by mod

PHP & Hash / Fragment Portion of URL

半世苍凉 提交于 2020-01-19 03:28:13
问题 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 only reachable through JavaScript. But would it be possible to create a link where the fragment is duplicated in the URL, parsed by PHP, and then removed by mod

How to run a JavaScript function when the user is visiting an hash link (#something) using JQuery?

梦想与她 提交于 2020-01-14 04:52:07
问题 I have a webb application at http://example.com/app and I would like to show a form if the user is visiting http://example/app#add-item . Is there any way I can use a jQuery script to add this functionallity? My current jQuery script already has a structure like this: $(document).ready( function() { $('#search').keyup( function() { ... } ); } ) How can I show a form using someting like this: $(document).ready( function() { $('#search').keyup( function() { ... } ); $('#add-item').visit( //

Selecting the anchor tag of a particular href using jQuery

蓝咒 提交于 2020-01-13 05:58:07
问题 THE AIM After refreshing the browser, I would like that the user stays in the menu/content they were before refreshing. THE PROBLEM After refreshing the browser, the content of the particular menu in which the user was before refreshing is shown as active (i.e. it is shown on the screen). However, the menu icon of that particular content is NOT shown as active (i.e. it does not show a black colour). I am struggling in selecting the anchor element (where the icon is found) of the current href

Triggering click on a link doesn't change location hash

爱⌒轻易说出口 提交于 2020-01-03 15:21:34
问题 I'm working on a web application that uses onHashChange event listener in some situations and manually clicking on a link with href="#hash" works perfectly well. But when I trigger click on the same link using jQuery's $('a[href=#"hash"]').trigger('click') or $('a[href=#"hash"]').click() hash in address bar is not changing. Is it something that I'm doing wrong? or I shoud use another method for this purpose? HTML <a href="#hash">Do Something</a> JS // Not working $('a[href="#hash"]').click();

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

好久不见. 提交于 2019-12-30 10:37:29
问题 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? 回答1: 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

Url fragment and Referer header

自闭症网瘾萝莉.ら 提交于 2019-12-30 08:10:10
问题 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? 回答1: The spec says that Referer can't

Jquery - tell when the hash changes?

回眸只為那壹抹淺笑 提交于 2019-12-30 05:28:09
问题 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

Preventing scroll when using URI hash to identify tab

房东的猫 提交于 2019-12-29 01:32:17
问题 I'm using JQuery UI to make tabs in my application. I needed the tabs to be linkable (direct link that opens the page and selects the correct tab). This is done by using a hash tag/fragmented identifier. But I have a issue when the content above the tabs and inside the tabs is very long. When clicking the tabs, the page scrolls down to the start of the tab. This is not what I want. I'm using Jquery 1.7.1 and Jquery UI 1.8.16. The javascript/Jquery code is a standard Jquery UI tabs with the

Handle URL anchor change event in js

北慕城南 提交于 2019-12-27 10:45:12
问题 How can I write the JavaScript callback code that will be executed on any changes in the URL anchor? For example from http://example.com#a to http://example.com#b 回答1: 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 so that scrollbars