Portfolio Query
I am in the process of setting up a basic portfolio website. My navigation bar includes various links, one of which is labeled "About Me". Upon clicking this link, the page immediately jumps to a specific section with an element ID of #about-me
, and the URL is updated to include #about-me
at the end.
However, I have noticed that when I refresh the page, the URL remains unchanged, causing the page to load at the same position instead of scrolling back to the top. I suspect this issue may be related to browser caching but I am not entirely certain.
What would be the most effective method to address this situation correctly?
Potential Resolutions
One approach could involve utilizing the jQuery
.ready()
function to invoke a script once the DOM has finished loading. This script could reset the scroll position by updating thewindow.location.href
to the original source URL.Alternatively, considering disabling browser caching might resolve the problem. However, it is important to note that this action could have implications for other areas of the site that rely on caching for optimized performance.