I’ve made this simple example:
<html>
<head></head>
<body>
<button onclick="changepath()">setPath</button>
<script>
function changepath() {
console.log("Setting hash");
window.location.href = window.location.href + "#hash";
};
(function () {
console.log("Self invoking:", new Date());
})();
console.log("Inline:", new Date());
</script>
</body>
</html>
What I want to do is navigate to an url fragment (#hash) and run a script when I click “back”.
It seems to me that scripts don’t run when you just set the fragment, but is it possible?