This repository has been archived on 2022-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
hydrogen-web/prototypes/ie11-hashchange.html
2020-10-13 17:10:45 +02:00

24 lines
658 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<ul id="changes"></ul>
<script type="text/javascript">
const ul = document.getElementById("changes");
window.onhashchange = function() {
const hash = document.location.hash.substr(1);
const li = document.createElement("li");
li.appendChild(document.createTextNode(hash));
ul.appendChild(li);
window.history.replaceState(null, null, "#" + hash + hash);
}
</script>
<p>
<a href="#foo">foo</a>
<a href="#bar">bar</a>
<a href="#baz">baz</a>
</p>
</body>
</html>