iframe not rendering in ipython-notebook

The following iframe will not render in an ipython-notebook

from IPython.display import HTML
HTML('<iframe src= width=700 height=350></iframe>')

but, this one will render (note, .com versus .org)

from IPython.display import HTML
HTML('<iframe src= width=700 height=350></iframe>')

Is there something I am doing wrong in the first example? If this is a bug, where do I submit a bug report?

1

4 Answers

IPython now supports IFrame directly:

from IPython.display import IFrame
IFrame(' width=700, height=350)

For more on IPython embeds check out this IPython notebook.

1

You have a "Refused to display document because display forbidden by X-Frame-Options." in javascript console. Some sites explicitly refuse to be displayed in iframes.

0

I was able to get some iframes to embed on my notebook server by modifying the url to use https:

from IPython.display import VimeoVideo
v = VimeoVideo(id='53051817', width=800, height=600)
print v.src
>>> '
v.src = v.src.replace('http','https')
v

use %%html magic cell command:

%%html
<iframe width="700" height="500" src="" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like