Created
January 29, 2012 21:27
-
-
Save Peksa/1700778 to your computer and use it in GitHub Desktop.
pushState tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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