Stop a Web Page from Scrolling to an Embedded Excel Sheet on Refresh
Question details
Find out why a web page scrolls to an embedded Excel sheet after refresh and how to prevent it.

- Product
- Microsoft Excel embedded spreadsheet
- Device & OS
- not provided
- Scenario
- A user refreshes a web page containing an embedded Excel spreadsheet.
- Observed behavior
- The browser scrolls to the spreadsheet, possibly because the embedded frame or a previously active cell receives focus.
Open the affected page and note whether the URL contains a fragment after a # symbol. If you manage the page, have access to its embed code and browser developer tools.
Check Whether the Excel Embed Receives Focus on Refresh
Use this approach when the browser appears to jump to the spreadsheet because the embedded frame becomes active.
Open the page in your browser, open Developer Tools, and run document.activeElement in the Console after the page loads. Check whether the result is the spreadsheet iframe.
In Developer Tools, inspect the iframe and search the page's source files for autofocus, focus(), and scrollIntoView(). Look for code that focuses the iframe or scrolls it into view during loading.
In the page source, remove or revise any automatic focus or scrolling that targets the spreadsheet unnecessarily. Keep intentional keyboard-accessible focus behavior.
Save the page changes, refresh the page, and check whether it still jumps to the spreadsheet. Also test keyboard navigation to confirm the embed remains usable.

Check Anchors and Browser Scroll Restoration
Use this approach if the iframe is not being focused by your page code but the browser still returns to the spreadsheet.
Work with Excel Spreadsheets in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for opening and editing spreadsheets. Its Microsoft Office format support helps you move existing files into WPS; it does not fix scrolling on a website that embeds Excel.

Frequently Asked Questions
Why does the page jump to the embedded Excel sheet after refresh?
The iframe may receive focus, or the browser may restore a previous scroll position. A URL fragment or page script can also move the page to the spreadsheet.
How can I tell if the spreadsheet iframe has focus?
After the page loads, open Developer Tools and enter document.activeElement in the Console. If it returns the spreadsheet iframe, the frame is the active element in the parent page.
Will disabling scroll restoration stop every jump to the sheet?
No. Setting history.scrollRestoration to 'manual' can stop automatic browser scroll restoration, but focus changes, URL fragments, and scripts can still move the page.
What if I cannot edit the website's code?
Check whether removing a # fragment from the address bar changes the behavior. For a permanent fix, share the page URL and your findings with the website administrator, who can inspect the embed and scripts.




