history.js

Is this a proper way to use History.js?

有些话、适合烂在心里 提交于 2019-11-28 16:54:21
问题 I was able to put together a simplified complete History.js example using three links to load fragments of content from a full page without updating the page and while updating the browser history. Here are the relevent code snippets - a complete working example is here http://jsfiddle.net/PT7qx/show <a href="/page-header">Page Header</a> <a href="/login-form">Login Form</a> <a href="/nothing">Nothing</a> <script> var History = window.History; if (!History.enabled) { return false; } History

jQuery & history.js example

柔情痞子 提交于 2019-11-28 04:35:33
I'm having a little trouble using history.js with jQuery. I just wanted to make a navigation set work with the back button (which they do seem to be doing quite nicely). However. When I click the back button the url changes to the old (which again is good and what I want) but the content does not replace as it should. To make this a little more understandable here's some code. <ul class="content_links"> <li><a href="/historyapi/pages/content_page_1.html">Content page 1</a></li> <li><a href="/historyapi/pages/content_page_2.html">Content page 2</a></li> <li><a href="/historyapi/pages/content

History API: Javascript Pushstate, get previous URL

安稳与你 提交于 2019-11-28 04:34:30
问题 $(window).bind('statechange',function(){ var State = History.getState(), url = State.url; }); In the following function, url returns the current URL. What I'm looking for is, within that function, to get the previous URL, so for example, if I'm on /cars/ferrari and go to /cars/ford , url would return cars/ford , but I want to get /cars/ferrari . How do I get the previous URL within a statechange event? 回答1: $(window).bind('statechange',function(){ // Prepare Variables var State = History

Html5 History Api - pushState from a domain to a subdomain

早过忘川 提交于 2019-11-28 03:18:40
问题 I have a website as the landing and information page to a web portal type of application. I need the link that goes to the portal to set off an animation that beautifully transitions to the portal view (navigation slides out, new navigation slides in, various widgets fade out, new ones fade in, etc). However, I also need the url to go from www.mydomain.com to portal.mydomain.com . I'm willing to go to any length to have BOTH, the animation to load the portal and the url to be a subdomain. As

history.pushState does not trigger 'popstate' event

为君一笑 提交于 2019-11-27 23:11:34
问题 Why $(function () { $(window).bind('popstate', function () {alert('pop');}); window.history.pushState(null, '', '/foo'); }); does not alert pop ? NB: Testing on latest chrome -- According to MDN: A popstate event is dispatched to the window every time the active history entry changes. If the history entry being activated was created by a call to pushState or affected by a call to replaceState, the popstate event's state property contains a copy of the history entry's state object. So why my

React history.push() is updating url but not navigating to it in browser

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 20:43:08
问题 I've read many things about react-router v4 and the npm history library to this point, but none seems to be helping me. My code is functioning as expected up to the point when it should navigate and do a simple redirect when the url is changed using the history.push() method. The URL IS changing to the specified route, but not doing the redirect on the button push. Thanks in advance, still learning react-router... I would like for the button push to do a simple redirect without the

Preserve dynamically changed HTML on back button

与世无争的帅哥 提交于 2019-11-27 17:17:31
It's amazing, I constantly see this working in other sites but never in sites that I'm working on. I'm bringing in new content with ajax, I know about history.js and the History API, I do not want to change the URL, just have the browser cache the new HTML content so when a user leaves the page and comes back using the back button, it still has the updated HTML. I see this working all the time in other sites without URL changes or using the hash #. Is there a trick to get it to work or is it randomly decided by the browser? If I don't want to use the URL to have this information, is there an

JQuery & history.js back button not working

五迷三道 提交于 2019-11-27 13:05:37
问题 I'm using history.JS (latest) with Jquery (latest) to load and replace just a portion of a website, this is all working, currently I'm only trying to get it working in modern browsers so I'm not fiddling with the hash changes. Everything seems to work, however when I click the back button on the browser (latest FF & Chrome) the page does not change (although the url and title do change). I've had a google and a look on here but I can't see what is happening. Looking on stack overflow I found

Preserve dynamically changed HTML on back button

和自甴很熟 提交于 2019-11-26 18:58:12
问题 It's amazing, I constantly see this working in other sites but never in sites that I'm working on. I'm bringing in new content with ajax, I know about history.js and the History API, I do not want to change the URL, just have the browser cache the new HTML content so when a user leaves the page and comes back using the back button, it still has the updated HTML. I see this working all the time in other sites without URL changes or using the hash #. Is there a trick to get it to work or is it