Fix OneDrive PDF Sharing Link Not Displaying in a React iframe
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.

- 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.
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.
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.
In SharePoint Online, open the site page where the React content or embedded document should appear, and click Edit to enter page editing mode.
Select the plus sign to add a web part, search for File Viewer, and choose the File Viewer web part from the results.
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.
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.

Embed OneDrive PDFs with a supported PDF viewer in an external React app
Use this approach when the React application is hosted outside SharePoint Online and the OneDrive :b sharing link is not returning embeddable PDF content.
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.

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.




