Embed documents for public viewing

I had some problems embedding anonymous documents so I’ll document the method here for future reference.

See draw.io for how to embed diagrams, or just use an image.

This is a standard cleaned up version of the embed code that can be used just by replacing the <URL> with the public URL and changing the title.

<iframe src="<URL>&action=embedview" 
frameborder="0" allowfullscreen title="a title" 
style="height:512px;width:100%;"></iframe>

Note: Since the switch to WordPress, it’s much easier to use a screenshot of the document as a thumbnail with Fancybox opening the embedded public URL described in this post instead of the iframe. An example of this can be found here.

Head over to OneDrive, open the document you want to embed and enable viewing mode.

Get the embed code.

To get the public URL, click on Share, change to Anyone can View and Copy link.

Now, just replace the URL from the original embed code with the public URL.

Note: be careful not to overwrite the “&action=embedview” or it won’t work.

Leave a Reply

Your email address will not be published. Required fields are marked *