Skip to content

Instantly share code, notes, and snippets.

@sydlawrence
Created December 2, 2010 10:03
Show Gist options
  • Save sydlawrence/725065 to your computer and use it in GitHub Desktop.
Save sydlawrence/725065 to your computer and use it in GitHub Desktop.
using history pushState
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title>window.history.pushState Example</title>
</head>
<body>
<h1>window.history.pushState Example</h1>
<script type="text/javascript">
/*
* this only works on same domain, for security reasons.
* Documentation: http://www.w3.org/TR/html5/history.html
* uses HTML5 javascript interface.
* browser support: http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML_5)#APIs
*/
window.history.pushState("", "Hello World", 'hello-world');
document.title = "Hello World";
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment