Search code examples
iframeinstagramembed

Instagram added x-frame-options DENY so their embed script stopped working?


When you want to embed an instagram post to your website, instagram offers an embed button which effectively uses <script async src="//www.instagram.com/embed.js"></script> and a blockquote to produce an iframe version of the post embeded into your own website.

Today found out instagram added a header x-frame-options:deny so their own script is not working any more.

Is this intended, how can you embed without the use of API a simple post any more ? The error your get is

The loading of [URL] in a frame is denied by “X-Frame-Options“ directive set to “deny“

.


Solution

  • I had the same problem and found answer. Works for my method. When you embed posts with insta copycode, you get in url like: instagram.com/p/xyz When you copy it straight from url bar, its: instragram.com/username/p/xyz

    You need to get rid of /username/ and it might work again.