history.js

How Does Github Do pushState Without Hash Tags?

混江龙づ霸主 提交于 2019-11-29 21:58:34
I've been researching the best way to utilize HTML5's history api aka psuhState with a proper fallback for HTML4 browsers. Github uses the history api for its tree browsing (the following link is just an example, not the library github uses): https://github.com/browserstate/History.js/ What I can't figure out is how they handle this functionality for HTML4 browsers such as Firefox 3.5? I've looked at, specifically, history.js (linked above) to handle this sort of thing. But it requires a hash # implementation for HTML4 browsers which I'd like to avoid. If you visit Github and browse a

Is this a proper way to use History.js?

自作多情 提交于 2019-11-29 20:20:58
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.Adapter.bind(window, 'statechange', function() { var State = History.getState(); History.log(State.data,

How do I actually use history.js on my site

和自甴很熟 提交于 2019-11-29 19:54:20
I've read all the posts about history.js on stackoverflow including, this , this and this and at looked the source code but as a newcomer to javascript/jquery I'm having trouble figuring out how to actually implement to have html 5 history support and fallback to support html4 browsers such as ie8/9. As I can appreciate the UX benefits from presenting consistent URL's as much as possible, how this solves deep linking and allows for bookmarking I want to implement but I get a bit lost when trying to actually use this on my site. After adding history.js script to my page The code to modify as I

HTML5 history disabling forward button

為{幸葍}努か 提交于 2019-11-29 11:55:46
问题 I am writing a single page javascript application using the HTML5 History API. The application loads content via Ajax and internally maintains state information on the foreground screen using a screen stack. I want to enable navigation with the back button, but I never want to the forward button to be enabled. A couple quick bits of information: The user should only ever be able to go back, never forward Pressing browser back button closes the current page screen user is on and reloads the

How can I detect the back/forwards buttons being clicked when using History.js?

本小妞迷上赌 提交于 2019-11-29 10:03:28
Im using History.js ( click ) with jQuery in my code. When loading new content via ajax i use: History.pushState({my:stateobject},"newtitle","supernewurl"); This seems to work since the URL is updated in the browser. However, I don't get it where I can hook up my code whenever a back or forward button is pressed. Which method/event is used for this? jgivoni You need to bind an event handler to the statechange event, like this: $(window).bind('statechange',function(){ // Do something, inspect History.getState() to decide what }) There is a complete javascript snippet that comes with History.js,

browser back and forward button does not invoke callback method with statechange event of history.js

拟墨画扇 提交于 2019-11-29 07:39:41
I used ( https://github.com/browserstate/history.js ) and have a piece of code like this History.Adapter.bind(window, 'statechange', function() { var State = History.getState(); alert('Inside History.Adapter.bind: ' + State.data.myData); }); function manageHistory(url, data, uniqueId){ var History = window.History; if ( !History.enabled ) { return false; } History.replaceState({myData: data}, null, '?stateHistory=' + uniqueId); } if I invoke manageHistory() after my ajax call, then History.Adapter.bind callback method get invoked correctly. However, if I click the browser back and then click

Can't understand History.js, need it simplified?

☆樱花仙子☆ 提交于 2019-11-29 00:10:24
问题 I'm fairly new to programming, and I'm making an AJAX site with the help of jQuery. I've looked around a fair bit for an AJAX history handler, and figured that History.js seems to be the best/most up-to-date. My menu buttons each have their own unique ID's (#homeBtn, #featuresBtn, #pricingBtn), and currently look like this: <a href="#home" class="homeMainMenuButton" id="homeBtn"><div class="homeMainMenuButtonText">Home</div></a> Can someone give me an example (preferably on jsfiddle) on how I

JQuery & history.js back button not working

◇◆丶佛笑我妖孽 提交于 2019-11-28 20:41:27
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 this page: Restoring content when clicking back button with History.js which seems to be asking a

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

旧巷老猫 提交于 2019-11-28 20:09:11
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 {forceRefresh:true}, which then reloads the whole page. import React from 'react'; import createBrowserHistory

pushState() and popState(): manipulating browsers' history

柔情痞子 提交于 2019-11-28 19:55:25
I am working on a small project in which I want to create an Ajax-style website. Content is loaded with jQuery's load() . As some of you know, the down side of this is that the URL does not change accordingly to the content that is displayed. To make this work you can use pushState() . Because this is not cross-browser supported, I used the plug-in history.js . This is working quite nicely, but the problem is that my back and forward buttons are not working as they should and I have no idea what I am doing wrong. The URL is changing correctly and the content is as well, but the title is not