fragment-identifier

Setting location.hash in frames

时光毁灭记忆、已成空白 提交于 2019-12-21 02:35:22
问题 I am using ajax to update the location of a page in a frame. But when setting the location of the hash (on Chrome and some versions of IE (5.5) specifically, but occasionally on IE7) the page is being reloaded. The following html demonstrates the problem. the main frame.... frame.html is <html><head> <frameset rows="*"> <frame src=sethash.html frameborder=0 scrolling=auto name=somebody> </frameset> </head></html> the sethash.html page is . <html><head> <script language=JavaScript> var Count =

Are there any javascript libraries for working with hashbang/shebang (#!) urls?

淺唱寂寞╮ 提交于 2019-12-20 10:44:21
问题 With all the negative press over Twitter and Gawker's use of hashbang urls I'm having a very hard time finding any examples/libraries for how to actually use them. I'd like to use hashbang urls in a javascript carousel on our website so we can link directly to a specific page of the carousel. Are there any good cross-browser libraries or examples (preferably non-jQuery, since we use Prototype) for both pushing new urls to the page location and for parsing the url on page load? 回答1: We've been

Why is “#.id” a bad selector in CSS/jQuery yet it works in an HTML anchor?

旧城冷巷雨未停 提交于 2019-12-19 05:03:39
问题 I'm using JSDoc. It generates ids with a period as in <a id=".someMethodName"></a> If another part of the page has <a href="#.someMethodName"></a> That works perfectly. Clicking the second anchor scrolls to the first. But, neither document.querySelector nor jQuery will find the anchor. Why does the browser itself accept this anchor but jQuery and querySelector do not? test("document.querySelector('#.someMethodName')", function() { document.querySelector('#.someMethodName'); }); test("$('#

.htaccess redirect with fragment

烂漫一生 提交于 2019-12-18 09:38:57
问题 I need to issue a redirect, using .htaccess, to a URL with a fragment (also known as an anchor), but it's automatically escaping the #. At the moment I want a hard-coded fragment, but for the sake of others if you know how to take it from the URL too that would be good. Ideally I should be able to use QSA as well. For example: http://www.exameple.com/test?foo=bar should become 1) http://www.example.com/?foo=bar#MYVALUE or taking the fragment from the url: 2) http://www.example.com/?foo=bar

retrieve the hash in the url with php?

房东的猫 提交于 2019-12-17 19:44:58
问题 someone here in SO told me that the hash (#) in the url could be retrieved by php function parse_url? is this true? my web site got a lot of ajax effects and i want to be able to pass an url with a hash to the index.php so it could display the information based on the hash values. eg. if a user clicks and navigates in my website and he found a thing he wants to share, then he could copy the address and send it to his friend and when this person enters he sees the same thing. i have tried

window.location.hash = “ ”; prevent scrolling to the top?

假如想象 提交于 2019-12-17 19:11:49
问题 in my website i set the url adress using window.location.hash = 'project_name'; but if i want to clean the adress url from any hashes (when i close a project) and i set window.location.hash = ''; it happens the page scrolls up to the top page there is any way to clean up the url without any side effect? thanks 回答1: There's the onhashchange event, but it cannot be cancelled reliably across browsers to prevent scrolling. The best solution is to record the scroll position before changing the

Can you use hash navigation without affecting history?

你说的曾经没有我的故事 提交于 2019-12-17 17:24:30
问题 I'm afraid it might be impossible but is there a way to change the hash value of a URL without leaving an entry in the browser's history and without reloading ? Or do the equivalent? As far as specifics go, I was developing some basic hash navigation along the lines of: //hash nav -- works with js-tabs var getHash = window.location.hash; var hashPref = "tab-"; function useHash(newHash) { //set js-tab according to hash newHash = newHash.replace('#'+hashPref, ''); $("#tabs li a[href='"+ newHash

Why does Twitter use a hash and exclamation mark in URLs, and how do they rewrite search URLs?

六月ゝ 毕业季﹏ 提交于 2019-12-17 15:55:08
问题 We understand the hash is for AJAX searches, but the exclamation mark? Anyone know? Also, the "action" attribute for their search form points to "/search," but when you conduct a search, the hash exclamation mark appears in the URL. Are they simply redirecting from "/search" to "/#!/search"? Note: the second part of the q remains unanswered: That is, are they redirecting the user from "/search" to "/#!/search", or do they send the user to "/search" and use JS on the page to rewrite the URL? –

What's the best library to do a URL hash/history in JQuery? [closed]

谁说我不能喝 提交于 2019-12-17 10:37:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I've been looking around JQuery libraries for the URL hash, but found none that were good. There is the "history plugin", but we all know it's buggy and isn't flexible. I am loading my pages inside a div. I'll need a way to do back/forward along with the url hashing. mydomain.com/#home mydomain.com/#aboutus

ASP.Net MVC RedirectToAction with anchor

☆樱花仙子☆ 提交于 2019-12-17 08:11:50
问题 I have the following problem: For example I have route like this: routes.Add(new Route("forums/thread/{threadOid}/last", new MvcRouteHandler()) Defaults = new RouteValueDictionary( new { controller = "Thread", action ="ShowThreadLastPostPage"}), Constraints = new RouteValueDictionary(new { threadOid = @"^\d+$" }) } ); Is there a way using RedirectToAction method navigate to the URL like this: forums/thread/{threadOid}/last#postOid 回答1: I think you should use the Redirect method along with Url