Instagram embed not showing the image

Hi, the instagram embed feature is not working for us. We retrieve the slices from API using javascript library (prismic-javascript):

But the embed html code ends with such script tag:

<script async src=\"//platform.instagram.com/en_US/embeds.js\"></script>

which, i believe, results in image not showing in embed:

While searching for the solution i've found that missing protocol in src url can be the cause of the issue, however, as i know, we can't control what Prismic API returns (what is included in embed slice html) so can you please advice the way in which this issue can be resolved? I can share more information in dm if needed. Thank you!

Hello @v.lunyov, I believe this might be happening because Facebook updated the Instagram oEmbed endpoint. You need to perform a different set of steps to retrieve the media you need instead of just rendering a plain HTML parsed string. You can read the details about it here: Facebook: oEmbed Read

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Hi Pau! Hope you are doing well and thanks for helping with the issue!
It appeared that Instagram embedjs script was not loading because embed code was attached via innerHTML approach and it didn't invoke the script to be loaded. Added the script manually in the dependency and execute this method each time i embed the content dynamically to get it work: window.instgrm.Embeds.process();. Now it works. Not connected to Prismic in any way actually but maybe someone will find this useful. Thanks!

Hi Vadim,

I'm really glad you were able to figure this out. Thanks for the update and I think this will really help people in the future.

Thanks again.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.