Embedding Instagram Posts in Modern SharePoint Pages using embed webpart
Embedding Instagram Posts in Modern SharePoint Pages using embed webpart
I was investigating on how to display an instagram post within a Modern SharePoint News Page.
The generic embed code from instagram post uses the script tag which is not allowed within SharePoint Modern Page unless script webpart is allowed to be used.
These are the steps to follow to get the embed code of an instagram post
- Navigate to the instagram post, e.g. https://www.instagram.com/p/CqN3lWpNMpI/ and click on ellipsis.
- Click on embed post.
- Copy the embed code.
- Paste the embed code
Once pasted within the embed code , the error message that script is not supported appears.
I found the solution from Introducing Web Embedding Instagram Content on Websites. Simply to append the “/embed” to the post URL, e.g. https://www.instagram.com/p/CqN3lWpNMpI/embed to include within the Iframe tag.
To whitelist the instagram domain, add www.instagram.com in HTML Field Security in site settings, follow the Allow or restrict the ability to embed content on SharePoint pages
Embed individual instagram post
To embed an individual post , use the following embed code below specifying scrolling and frameborder properties. Replace with instagram post reference.
<iframe width="724" height="724" src="https://www.instagram.com/p/<postRef>/embed" player"="" frameborder="0" scrolling="no"></iframe>
Embed instagram account
To embed an instagram account , use the following embed code below specifying scrolling and frameborder properties. Replace with instagram accountname.
<iframe width="1024px" height="1200px" src="https://www.instagram.com/<accoutname>/embed" scrolling="no" frameborder="0"></iframe>
The above method using the embed webpart with the iframe code does not require any access tokens or authentication.