Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.