How to Publicly Embed OneDrive PDF Files Without Sign-In
Question details
Users need to embed a PDF file stored in a business OneDrive or SharePoint account into a public web page using an iframe, ensuring visitors can view the document without being prompted to sign in.

- Product
- Microsoft OneDrive / SharePoint
- Device & OS
- not provided
- Scenario
- Embedding a business PDF document into a public-facing website via an iframe.
- Observed behavior
- The embedded PDF file refuses to load in a public iframe because Microsoft blocks anonymous iframe embedding or enforces authentication for business accounts.
Ensure you have the necessary permissions to share files publicly from your organization's OneDrive or SharePoint account, as external anonymous sharing is often restricted by IT administrators.
Configure 'Anyone with the link' Permissions and Generate Embed Code
Use this solution to adjust file sharing permissions to allow anonymous access before generating the official OneDrive embed code.
For a file to be visible to the public without requiring a login, its sharing permissions must be explicitly set to allow anonymous access. This method relies on your organization allowing external sharing.
Open OneDrive or SharePoint in your web browser, locate your PDF file, and click the 'Share' icon next to the file name.
Click the current permission setting (e.g., 'People in your organization') to open the Link settings. Select 'Anyone with the link' and click 'Apply'.
Select the file, click the three-dot menu (More options), and choose 'Embed'. A panel will appear on the right side. Copy the provided iframe code.
Paste the iframe code into your website's HTML. Open your webpage in a private or incognito browsing window to verify that the PDF loads without a sign-in prompt.

Host the PDF on a Public Web Delivery Service
Use this solution if your organization strictly prohibits anonymous OneDrive sharing or if Microsoft continues to block the iframe due to security headers.
Create and Manage PDFs Unrestrictedly with WPS Office
Bypass complicated Microsoft cloud sharing permissions by managing your PDFs locally. WPS Office is a free, lightweight alternative to Microsoft Office that allows you to effortlessly create, edit, and export PDFs, ensuring they are ready for any public web hosting platform without unexpected sign-in blocks.
- 1. Open Your Document: Launch WPS Office and open your source document or existing PDF.
- 2. Edit and Finalize: Use the comprehensive built-in tools to modify text, adjust layouts, or add annotations as needed.
- 3. Export Locally: Click on 'Menu' and select 'Export to PDF' to save a clean, restriction-free local copy ready to be uploaded to your public web server.

Frequently Asked Questions
Why does my embedded OneDrive PDF show a sign-in error on my website?
Business OneDrive and SharePoint accounts have strict security policies. They often prevent files from rendering in public iframes to protect against clickjacking, or they require authentication unless external anonymous sharing ('Anyone with the link') is explicitly enabled.
Can I bypass the login by adding 'action=embedview' to the sharing URL?
While appending '&action=embedview' to a standard sharing URL optimizes the layout for web embedding, it does not bypass underlying authentication requirements. If the file is not shared publicly, users will still face a login prompt.
What should I do if 'Anyone with the link' is greyed out in OneDrive?
If this option is unavailable, it means your organization's IT administrator has disabled anonymous external sharing for security reasons. You will either need to request an exception from your IT department or host the PDF on a separate public web server.




