1

I'm trying to use the facebook SKD to embed a post in my Shiny app. I have the iframe of a public post.

<iframe src="https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fladygaga%2Fposts%2F10157645664974574&width=500" width="500" height="594" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allow="encrypted-media"></iframe>

Currently I'm using the shiny HTML() function and I managed to see the fb_iframe_widget in the developer console. But the post is not showing.

enter image description here

This is what my current approach looks like:

ui <- fluidPage(
HTML('<div id="fb-root"></div>
     <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.3"></script>')

HTML('<iframe src="https://www.facebook.com/plugins/post.php? href=https%3A%2F%2Fwww.facebook.com%2Fladygaga%2Fposts%2F10157645664974574&width=500" width="500" height="594" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allow="encrypted-media"></iframe>')
))

I also tried doing what they do here: embed iframe inside shiny app

It didn't work. I get the iframe but not the post.

dank
  • 303
  • 4
  • 20

1 Answers1

1

Your codes work perfectly fine. But you need to open the app in a separate browser. Iframe doesn't work in Rstudio Viewer Pane.

enter image description here

yusuzech
  • 5,896
  • 1
  • 18
  • 33