How to Embed a OneDrive File on a Website Without Requiring Sign-In
Question details
The user wants to embed a file from OneDrive onto a public website so that visitors can view the content without having to log into a Microsoft account.

- Product
- OneDrive
- Device & OS
- not provided
- Scenario
- Embedding a document or media file onto a public website for unauthenticated visitor access.
- Observed behavior
- Embedded OneDrive files are prompting website visitors to authenticate and sign in, preventing seamless public viewing of the content.
Ensure you have owner permissions for the OneDrive file you intend to embed, and verify whether your organization's Microsoft 365 administrator allows anonymous external sharing.
Enable 'Anyone with the link' sharing permissions
Adjusting the file's sharing settings to allow anonymous access before generating the embed code can bypass the sign-in prompt, provided tenant settings allow it.
By default, OneDrive files are often restricted to authenticated users within your organization. To embed a file publicly, you must generate an anonymous sharing link first.
Open your web browser, navigate to the OneDrive website, log in with your Microsoft credentials, and locate the file you want to embed.
Right-click the file and select 'Share'. Click on the permission settings (usually defaults to 'People in your organization') and change it to 'Anyone with the link'.
Once the anonymous link is created, close the sharing dialog. Right-click the file again, select 'Embed', and click 'Generate'. Copy the provided HTML iframe code and paste it into your website's source code.

Use an alternative hosting service for public files
If your Microsoft 365 environment strictly requires authentication for all files, you will need to host the file outside of OneDrive for public embedding.
Share and View Documents Seamlessly with WPS Office
If Microsoft 365 tenant restrictions are making it difficult to share files publicly without sign-in prompts, WPS Office provides a highly compatible and lightweight alternative. You can create, edit, and easily share documents with anyone, bypassing complex enterprise permission barriers while maintaining perfect formatting.
- 1. Download WPS Office: Install the free WPS Office suite on your Windows, Mac, or Linux computer.
- 2. Open or create your document: Launch the application and open your existing Microsoft Office files or create a new document from scratch.
- 3. Share without hassle: Use the built-in 'Share' feature to generate a quick, accessible link for your colleagues or audience.

Frequently Asked Questions
Why is the 'Anyone with the link' option grayed out in OneDrive?
This option is disabled when your organization's Microsoft 365 IT administrator has turned off anonymous external sharing at the tenant level to enforce data security policies.
Can I embed a SharePoint document without requiring a login?
Just like OneDrive, SharePoint requires authentication for embedded files unless anonymous guest access is explicitly enabled in the SharePoint admin center.
If I update the original file in OneDrive, will the embedded version on my website update automatically?
Yes, as long as the file is successfully embedded directly from OneDrive, any edits saved to the original document will automatically reflect on your website upon refreshing the page.




