Skip to content

Instantly share code, notes, and snippets.

@Peksa
Created January 29, 2012 21:27
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 Peksa/1700778 to your computer and use it in GitHub Desktop.
Save Peksa/1700778 to your computer and use it in GitHub Desktop.
pushState tests
<!DOCTYPE html>
<html>
<head>
<title>#{get 'title' /}</title>
<meta charset="UTF-8">
<script src="@{'/public/javascripts/jquery-1.7.1.min.js'}"></script>
</head>
<body>
<a href="#" id="home">Hem</a>
<a href="#" id="local">Lokal</a>
<a href="#" id="absolute">Abs</a>
<a href="#" id="subdomain">subdomain</a>
<script>
$(document).ready(function() {
$("#home").click(function() {
history.pushState({}, "", "/"); // Works
return false;
});
$("#local").click(function() {
history.pushState({}, "", "/this/is/a/test"); // Works
return false;
});
$("#absolute").click(function() {
history.pushState({}, "", "http://domain.me:9001/hejsan"); // Works iif domain is domain.me:9001
return false;
});
$("#subdomain").click(function() {
history.pushState({}, "", "http://sub.domain.me:9001/yo"); // Works iif domain is sub.domain.me:9001
return false;
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment