fragment-identifier

Handle URL anchor change event in js

限于喜欢 提交于 2019-12-27 10:44:04
问题 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

Is it possible to make an href jump on the same page with the destination element not having an id?

拈花ヽ惹草 提交于 2019-12-25 09:28:15
问题 Is it possible to make an <a href> link to the same page when your destination doesn't have an ID? <a href = "#">Jump to Topic 1</a> ... <!--destination is below--> <h1 class="tab-title" data-editor-style="title" style="color:#444444">Topic 1</h1> 回答1: Sadly, the answer is no. You need an ID or at least a name, like CBroe mentioned in a comment of your question. However, I found this here: Today, all browsers recognize top as being the top of the page. If you want the visitor to go to the

How to prevent fragment identifiers from showing in url

為{幸葍}努か 提交于 2019-12-25 04:22:37
问题 I have a link like this <a href="#login_form">Log in</a> after clicking on the link the url changes from http:/domain.com to http://domain.com#login_form and a login form pops up. But i do not want hash tag to be displayed in url. How to do this using java script? No java script used to display login form which pops up. The login form is something like this. <a href="#x" class="overlay" id="login_form"></a> <div class="box"> <h2>LOG IN</h2> <form name="login" action="" method="post"> </form>

How to Read / Write or Preserve Fragment Identifiers on Post-back

╄→гoц情女王★ 提交于 2019-12-25 01:45:52
问题 I'm using fragment identifiers to run a tabbed browsing control and it would be nice if the post-back could preserve the tab as that is less jarring to the user. To that end I've been searching for a method to preserve the fragment identifier and am at a total loss. Is there a way to read or save the fragment identifier from the referring url during a page post-back in ASP.NET? 回答1: You can't save/retrieve URL fragments on the server side because Browsers don't send them -and they aren't

redirecting to a specific page when clicking browser's back button

拟墨画扇 提交于 2019-12-24 03:07:51
问题 it's a bit of a nooby question, but there it goes: i have a site where the user can only navigate from page to page via next and back buttons. i.e there is a wizard the user must follow. part of the wizard includes different pages and part includes the same page but with changing divs (but from user experience its a different page). i would like to simply redirect the user to the first page of the wizard, whenever he clicks on the browser's back button. if possible and simple, i prefer doing

Disabling hashchange listener when updating hash programatically (jQuery BBQ)

怎甘沉沦 提交于 2019-12-23 15:35:26
问题 To prevent a feedback loop when setting the URL hash (#) programmatically (in contrast to manually changing the URL) I want to disable the hashChange listener temporarily. How should I change this code to actually disable the hashchange event when updating the hash using $.bbq.pushState(hash)? (code below doesn't work) hashChangeEnabled : true, bindHashChange : function(){ var that = this; $(window).bind( 'hashchange', function( event ) { if(that.hashChangeEnabled == true){ stateObj = event

What is Fragment URLs and why to use it

你说的曾经没有我的故事 提交于 2019-12-23 07:49:21
问题 I am new in PHP Development. Today I came across the interesting topic URL fragmentation specifically the '#' part of the URLs. I searched about that It says it's like www.example.com\foo.html#bar. But I don't understand why this "#bar" is needed. and how to read it by PHP? 回答1: A fragment is an internal page reference, sometimes called a named anchor. It usually appears at the end of a URL and begins with a hash (#) character followed by an identifier. It refers to a section within a web

Javascript anchor navigation

折月煮酒 提交于 2019-12-23 06:41:44
问题 I am creating a website with the "anchor navigation" like used with facebook and google mail. I have got it working but not fully. When I load the page with something like #contact it won't load it in unless I click the link for it. Also, would there be a better, more efficient way to do what I am doing? I am not the best person with JS programming. JavaScript : $.navigate = function() { // a new link if($anchor != document.location.hash){ // add a preloader $("#content") .empty() .html('<p

Was there ever a proposal to include the URL fragment into the HTTP request?

不羁岁月 提交于 2019-12-23 04:08:44
问题 In the current HTTP spec, the URL fragment (the part of the URL including and following the # ) is not sent to the server in any way. However with the increased spread of AJAX, which uses the fragment to maintain some form of state, there are a lot of situations where it would be useful for the server to have knowledge of the URL fragment at request time. For example, if you go to http://facebook.com, then click a user name in your stream, the URL will become http://faceboook.com/#!/username

prevent window.onhashchange from executing when hash is set via JavaScript

十年热恋 提交于 2019-12-22 07:05:24
问题 I use the window.onhashchange function to execute code when the User changes the hash of the page: window.onhashchange = function() { /* do something */ }; In some functions I also set the hash via JavaScript: window.location.hash = "#abc"; I want to prevent the onhashchange event from firing when I set the hash via JavaScript. What I have tried so far: var currently_setting_hash = false; window.onhashchange = function() { if (currently_setting_hash) return; //... } currently_setting_hash =