Skip to content
Snippets Groups Projects
Commit e99fec7f authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Added playground for history manipulation.

parent 76acadc8
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PAGE 1</title>
</head>
<body>
<h1>Page 1</h1>
<button type="button" id="page2button">Page 2</button>
<script src="../../js/jquery.min.js"></script>
<script>
$(function () {
$("#page2button").click(function (event) {
window.location = "page2.html";
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PAGE 2</title>
</head>
<body>
<h1>Page 2</h1>
<button type="button" id="page3button">Page 3</button>
<button type="button" id="closebutton">Close</button>
<script src="../../js/jquery.min.js"></script>
<script>
$(function () {
$("#page3button").click(function (event) {
window.history.replaceState({pageName: "Page 2"}, null, null);
window.location = "page3.html";
});
$("#closebutton").click(function (event) {
window.history.back();
});
if (history.state) {
console.log("State: " + history.state.pageName);
} else {
console.log("No State");
}
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PAGE 3</title>
</head>
<body>
<h1>Page 3</h1>
<button id="page3button">Page 3</button>
<button id="closebutton">Close</button>
<script src="../../js/jquery.min.js"></script>
<script>
$(function () {
window.history.state
window.history.replaceState(null, null, '#fragid');
$("#page3button").click(function (event) {
window.location = "page3.html";
});
$("#closebutton").click(function (event) {
//window.history.back();
window.location = "page2.html";
});
});
</script>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment