How to Get the Current Page Number in Office Online Viewer
Question details
The user wants to programmatically retrieve the current page index or page number in the free Office Online Viewer (view.officeapps.live.com).

- Product
- Office Online Viewer
- Device & OS
- not provided
- Scenario
- Embedding or viewing documents online and attempting to read the page index using a JavaScript method.
- Observed behavior
- The online viewer lacks an exposed JavaScript method or API for reading the current page index, preventing programmatic page navigation.
Understand that the free Microsoft Office Online viewers offer limited feature sets compared to premium or desktop versions, particularly regarding developer APIs and programmatic navigation control.
Use a Desktop Application or Alternative Viewer API
Since the free Office Online viewer does not support retrieving page numbers via API, transitioning to a desktop client or a more robust document viewer SDK is necessary.
The free Office Online viewers (view.officeapps.live.com) are designed strictly for basic document rendering and sharing. They deliberately do not expose a comprehensive JavaScript API, meaning you cannot read the current page index or programmatically jump to specific pages.
To achieve programmable document navigation, you must rely on desktop applications that support COM automation and macros, or implement a specialized third-party web document viewer that provides a robust developer API.
Determine if you strictly need a web-based solution for end-users or if a desktop application can fulfill your project requirements.
If web embedding with programmable navigation is strictly required, transition away from the free Microsoft viewer and implement a dedicated PDF/Office web viewer SDK.
Download the document locally and open it using a desktop office suite. Desktop clients offer comprehensive navigation panes, go-to-page shortcuts, and macro capabilities.

Switch to WPS Office for a Powerful Desktop Experience
Since Office Online Viewer limits your ability to navigate documents programmatically, try WPS Office. It provides a robust desktop experience that allows full control over document navigation, offline viewing, and is highly compatible with Microsoft Word, Excel, and PowerPoint formats, all for free.

Frequently Asked Questions
Can I jump to a specific page using JavaScript in Office Online Viewer?
No. The free Office Online viewers do not provide a JavaScript method to control navigation or jump to specific pages programmatically.
Are there better APIs available for Office documents on the web?
Yes. While the free viewer restricts API access, enterprise environments can utilize the Microsoft Graph API or specialized Office Add-ins, or integrate third-party document viewer SDKs that explicitly support JavaScript controls.
How can I easily navigate large documents if the online viewer is limited?
The best approach is to download the document from the web and open it in a fully-featured desktop application like WPS Office, where you can use the navigation pane, bookmarks, or the 'Go To' feature to jump to any page instantly.




