I would like to embed Sharepoint-hosted PDF documents in an iframe in a (non sharepoint) application on a different domain.
I have several hundreds of these documents listed by my client but I only know their filenames, not Sharepoint unique IDs.
Using the iframe code from the Embed
Sharepoint menu works when I do it manually, but the URL in the iframe has a file ID, not filename, so in my application I cannot use that code as a template on the whole series of files unless the client goes through the long task of listing each file ID.
A Sharepoint admin at my client's pointed me at an alternate URL containing only the filename that kind of works for Word documents when you reference it in an iframe:
https://xyz.sharepoint.com/:b:/r/sites/site/whatever/the_document.docx
The behavior when I put this in an iframe is that the browser successfully downloads the file. However:
- I don't have docx's but pdfs
- I don't want to download the file but display it in a file viewer in the iframe.
When I use the same URL format but with a PDF, I get the dreaded "xyz.sharepoint.com refused to connect" content security policy error in the iframe.
Why does the above URL format work with a Word document but not a PDF? Any thoughts on how to embed pdfs whose only data you know about is their file name?