Others

How to Get the Current Page Number in Office Online Viewer

Olivia MillerOlivia Miller Oct 26, 2026 868 views

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).

How to Get the Current Page Number in Office Online Viewer
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.
Before you start

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.

Solution 1Recommended

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.

1
Evaluate your navigation requirements

Determine if you strictly need a web-based solution for end-users or if a desktop application can fulfill your project requirements.

2
Switch to a supported API platform

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.

3
Use a fully-featured desktop client

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.

Use a Desktop Application or Alternative Viewer API
API Limitation: There is currently no official workaround to bypass the JavaScript API restrictions on view.officeapps.live.com.
Free Microsoft Office alternative

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.

Highly compatible with Microsoft Office formats (DOCX, XLSX, PPTX)Lightweight and fast to install on Windows, Mac, and LinuxAdvanced document navigation capabilities missing from basic online viewersFamiliar user interface with zero learning curve for seamless migration
microsoft office alternative - wps office

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.