PDF Opening Issues

Fix OneDrive PDF Sharing Link Not Displaying in a React iframe

John WilsonJohn Wilson Nov 13, 2026 869 views

Question details

The user needs OneDrive for Business PDF sharing links to render inside a React iframe the same way Word, Excel, and PowerPoint links do, instead of opening in a separate browser tab.

Fix OneDrive PDF Sharing Link Not Displaying in a React iframe
Product
OneDrive for Business / SharePoint Online
Device & OS
not provided
Scenario
A React web application embeds OneDrive for Business sharing links for Office documents. Word, Excel, and PowerPoint links display in an iframe, but PDF links behave differently.
Observed behavior
PDF links using the :b format open only in a separate browser tab and do not render in the React iframe.
Before you start

Confirm whether the React application is hosted in SharePoint Online or an external environment, and check the exact OneDrive PDF sharing link format and file permissions before choosing an embedding method.

Solution 1Recommended

Use the SharePoint File Viewer web part for SharePoint Online applications

Choose this when the React app or target page is hosted in SharePoint Online and you need a supported, no-code way to display OneDrive PDFs inline.

The File Viewer web part is the approved SharePoint Online method for displaying PDF documents from OneDrive or SharePoint document libraries. It avoids relying on OneDrive sharing links that do not always return embeddable PDF content for iframes.

1
Edit the SharePoint site page

In SharePoint Online, open the site page where the React content or embedded document should appear, and click Edit to enter page editing mode.

2
Add the File Viewer web part

Select the plus sign to add a web part, search for File Viewer, and choose the File Viewer web part from the results.

3
Add the OneDrive PDF file

In the File Viewer web part, paste the OneDrive PDF sharing link or browse to select the PDF from a SharePoint document library, then confirm the file name appears.

4
Publish and test the page

Click Publish or Republish to save the page, open the page in the React app context, and confirm the PDF renders inline instead of opening in a new browser tab.

Use the SharePoint File Viewer web part for SharePoint Online applications
SharePoint Online only: The File Viewer web part is designed for SharePoint Online. External React applications hosted outside SharePoint should use a supported PDF viewer instead.
Free Microsoft Office alternative

Use WPS Office as a Free Microsoft Office Alternative for PDF and Office Files

When OneDrive and SharePoint embedding workflows create extra steps, WPS Office offers a free, lightweight way to open, edit, and share PDFs, Word documents, Excel workbooks, and PowerPoint presentations. It preserves Microsoft Office format compatibility and provides a familiar ribbon interface for seamless migration.

Built-in PDF viewing, editing, and conversion tools for OneDrive filesFull compatibility with Word, Excel, PowerPoint, and PDF formatsFree and lightweight Office suite with a familiar ribbon interfaceReduces dependence on browser iframe and sharing-link workaroundsSeamless migration from Microsoft Office and OneDrive workflows
microsoft office alternative - wps office

Frequently Asked Questions

Why does a OneDrive PDF sharing link open in a separate tab while Word, Excel, and PowerPoint links display in an iframe?

OneDrive sharing links do not always provide an embeddable PDF response for iframe use. Office documents may return Office Online embed content, but PDF links using the :b format can open in a separate browser tab instead of returning iframe-friendly content.

How do I embed a OneDrive PDF in SharePoint Online?

Use the SharePoint File Viewer web part. Edit the target site page, add the File Viewer web part, paste the OneDrive PDF link or select the file from the document library, and publish the page.

What can I use in an external React app when a OneDrive PDF link will not render in an iframe?

Use a supported PDF viewer such as PDF.js or a commercial React PDF viewer. Provide a direct PDF URL with correct sharing permissions and include required authorization headers or a pre-authenticated URL.

Do OneDrive sharing permissions matter when embedding PDFs?

Yes. The PDF must be shared with the intended users. If you use a direct PDF URL, the viewer must be able to access it with the appropriate headers or pre-authenticated link, or users will see an error or a new-tab fallback.

Can WPS Office open a PDF that is downloaded from OneDrive?

Yes. WPS Office can open, edit, convert, and share PDF files downloaded from OneDrive. It also supports Word, Excel, and PowerPoint files with Microsoft Office format compatibility.