スキップしてメイン コンテンツに移動

投稿

ラベル(Ajax)が付いた投稿を表示しています

JSONP + Push State: Youtube Application Example

Improve Performance for MySQL CALC_FOUND_ROWS with LIMIT OFFSET Push State Push state is html5 technology that records browsing history in javascript without actual page refresh. Push state is useful for recording Ajax request, which cannot record the browsing history normally, and telling the corresponding url for the Ajax request to browser. The minimum push state code is below: // push the browser state if (typeof(history.replaceState) !== "undefined") { history.pushState({prop1: "a", prop2:"b"}, null, "/url/?param1=param"); } // when browser back button is pressed, pop state event is fired // pop state handler is registered in the folloing code window.onpopstate = function (event) { if (event.state == null) { return; } // do something nice ;) // using "event.state.prop1" for example }; The usage of push state is quite simple. One thing you should remember is that when pop state event is fired, the browse