15. Web State
Web Pages/Applications are Stateful
The back & forward buttons in the browser traverse
state
The URL is a link to the state
16. Web State
Web Pages/Applications are Stateful
The back & forward buttons in the browser traverse
state
The URL is a link to the state
Search engine crawlers take a snapshot of each
possible state, and indexes them
35. HTML5 History API
2 new methods:
pushState
replaceState
1 new event on the window object:
36. HTML5 History API
2 new methods:
pushState
replaceState
1 new event on the window object:
onpopstate
37. pushState
// This object is passed to the onpopstate event when it is fired. You
// can fill this object with what ever you like.
var stateObject = {
title: 'This Awesome Post',
createdAt: '2010-10-10',
author: 'keithpitt'
};
// At the moment, most browsers are ignoring this property, so just fill it with
// the title of the new page. According to Firefox, they _may_ use it in the
// future.
var title = 'This Awesome Post';
// The full URL of the new page.
var url = '/posts/this-awesome-post';
history.pushState(stateObject, title, url);