prototype for hash changes in IE11
This commit is contained in:
parent
2333a959a2
commit
2b2392f375
1 changed files with 24 additions and 0 deletions
24
prototypes/ie11-hashchange.html
Normal file
24
prototypes/ie11-hashchange.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<!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>
|
Reference in a new issue