Skip to content

Instantly share code, notes, and snippets.

@sang4lv
Created January 3, 2013 11:24
Show Gist options
  • Save sang4lv/4442785 to your computer and use it in GitHub Desktop.
Save sang4lv/4442785 to your computer and use it in GitHub Desktop.
History API
window.history.back();
window.history.forward();
window.history.go(); //optionally give a number. -1 = back, 1 = forward
var allEntries = window.history.length; //entry length
var currentState = window.history.state;
history.pushState(, "Introduction to History API", "working.html");
history.replaceState(, "Briefs on History API", "current.html");
history.onpopstate = function() {
console.log("It has navigated to a different page");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment