No, it is not possible to modify the window.location.hash without causing the webpage to scroll. When the hash is modified, the browser automatically tries to scroll the element whose ID matches the new hash value into view. However, there are some workarounds like using the HTML5 history API to modify the URL without changing the hash, or using JavaScript to temporarily disable scrolling while the hash is changed.
Asked: 2023-07-16 14:40:47 +0000
Seen: 15 times
Last updated: Jul 16 '23