Skip to content

Commit 99eed22

Browse files
committed
html/template.html: fix location hash redirect
When no hash is present, `locationHashChanged` will add an extra `#` symbol at the end of the URL. This is problematic as it adds another entry in the browser history, making it impossible to go back to previous page using the browser 'back button'.
1 parent ac73235 commit 99eed22

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/html/template.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ <h4>
251251
if(field && document.getElementById(`${peripheral}-${register}-fields`)) {
252252
document.getElementById(`${peripheral}-${register}-fields`).open = true
253253
}
254-
window.location.hash = window.location.hash
254+
if (window.location.hash) {
255+
window.location.hash = window.location.hash
256+
}
255257
}
256258
window.addEventListener("hashchange", locationHashChanged)
257259
locationHashChanged()

0 commit comments

Comments
 (0)