Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding Instagram via JavaScript

We are using Instagram's oEmbed-API to get embed codes. However, we do not want to solely rely on that API and generate embed codes ourselves. The embed code as provided by the API (or the website) includes a lot of html, css image data and text content, all of that already has to be there before you can work the embed js on it. This is a problem because we cannot implement a generic embed code but have to know the instagram content for each photo or video in advance.

My question is: Ist there a generic embed code, something like this, for instagram?

<script async defer=\"defer\" src=\"//platform.instagram.com/en_US/embeds.js\"></script>
<script>instgrm.Embeds.genenerate('some instragram ID for instance')<script/>
like image 626
Lukas Avatar asked Nov 16 '16 14:11

Lukas


People also ask

Does Instagram allow embedding?

Embed codes allow your profile or content to be shared along with your username and a link to your Instagram profile. Note that for a post or profile to be embedded, your account must be public and the Embeds setting must be turned on. Private accounts and content from private accounts cannot be embedded.

Can I embed Instagram in an iFrame?

Login to your iFrame website admin panel and create or edit a page. Paste the embed code where you want the Instagram feed widget to appear. Save and view your page. Done!

Does Instagram have JavaScript?

Instagram, another popular application, injects JavaScript code as well. While it does not monitor keyboard inputs, it does monitor all JavaScript messages and all text selections, and injects external JavaScript code.


1 Answers

You can use iframe to embed like this:

<iframe src="https://www.instagram.com/p/BFKjVxkBsCC/embed" width="400" height="480" frameborder="0" scrolling="no" allowtransparency="true"></iframe>

adding /embed to instagram post URL will give you image that can be embedded

adding /embed/captioned will add caption to the image

Here is link to easily generate embed code: https://www.picodash.com/instagram/embed#https://www.instagram.com/p/BFKjVxkBsCC/

like image 118
krisrak Avatar answered Sep 20 '22 07:09

krisrak