2013-07-12 193 views
3

以下的iframe在IPython的笔记本IFRAME在IPython的笔记本不渲染

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

不会渲染,但是,这一次将渲染(注意,.COM与.ORG)

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

在第一个例子中,我做错了什么?如果这是一个错误,我应该在哪里提交错误报告?

+0

也许使用从IPython显示IFrame对象会工作... – Matt

回答

4

您有一个“拒绝显示文档,因为X-Frame-Options禁止显示”。在JavaScript控制台。有些网站明确拒绝在iframe中显示。

0

我能够通过修改URL中使用HTTPS得到一些的iframe嵌入我的笔记本电脑的服务器上:

from IPython.display import VimeoVideo 
v = VimeoVideo(id='53051817', width=800, height=600) 
print v.src 
>>> 'http://player.vimeo.com/video/53051817' 
v.src = v.src.replace('http','https') 
v 
13

IPython的现在支持的IFrame直接:

from IPython.display import IFrame 
IFrame('http://stackoverflow.org', width=700, height=350) 

更多关于IPython的嵌入看看这个IPython notebook.

+2

链接不工作 – AbdealiJK

+0

链接[here](htt p://nbviewer.jupyter.org/github/ipython/ipython/blob/1.x/examples/notebooks/Part%205%20-%20Rich%20Display%20System.ipynb)类似于看起来有最初被链接。 – Wayne