Skip to content Skip to sidebar Skip to footer

Browser Jumps To Middle Of Page When Loading Html File

When I open an HTML file in Chrome, the page loads with some random h3 tag from the middle of the document (see last h3 tag in code below) at the top of the window, instead of the

Solution 1:

I think I know what's going on now. The issue isn't with the tags that are loading at the top of the page, but with an autofocus button that appears a few lines down:

<h4>Autofocus button</h4><buttontype="button"autofocus>Autofocus button</button>

For anyone playing around with autofocus buttons, it seems like they cause the browser to "autofocus" (duh) on that point upon loading. In my original case, my page loaded with the autofocus button on the bottom of the window, some headings from a few lines up at the top, and the actual top of the page nowhere in sight.

Solution 2:

Without being able to see you code, I would guess that you have an anchor tag somewhere that it is trying to navigate to. If you have a hash (#) in your URL, is in 99% likely. Otherwise, check your JS for a random scroll function that is attached to the wrong thing or perhaps running too early.

Without being able to see the code, this would be my best guess.

Post a Comment for "Browser Jumps To Middle Of Page When Loading Html File"