Is there a way to detect a JavaScript event triggered when the page is refreshed in Safari, causing it to return to the previous scroll position?
This situation can be frustrating because the scroll event only responds to user-initiated scrolls and won't work in this scenario. I need to identify an event that triggers specifically when the page is refreshed since DOMContentLoaded fires too early, and the window's load event is too late for my needs.
I am looking for a solution as I rely on checking if an element is currently in view using getBoundingClientRect.
Is there something crucial that I'm missing here? Without jQuery, which provides document.ready(), I am limited to vanilla JS without a clear alternative (even though document ready appears unlikely to help based on its source code).