Skip to content

Instantly share code, notes, and snippets.

@rATRIJS
Created October 24, 2011 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rATRIJS/1310099 to your computer and use it in GitHub Desktop.
Save rATRIJS/1310099 to your computer and use it in GitHub Desktop.
HTML5 Fake History Example
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>HTML5 'pushState' History Example</title>
<script type="text/javascript" charset="utf-8">
var original = document.location.href;
history.pushState({
isFakeHistory: true,
fakeHistoryURL: "fake-history.html"
}, "Fake History", "fake-history.html");
history.pushState({}, "Original State", original);
window.onpopstate = function(event) {
if(event.state.isFakeHistory)
document.location = event.state.fakeHistoryURL;
}
</script>
</head>
<body>
<p>Page 1</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment