Run IPython Notebook in Iframe from another Domain

强颜欢笑 提交于 2020-01-03 15:16:09

问题


I want to run an IPython notebook that is on my server inside an iframe on another server. I get this error:

Refused to display 'my_url/Test.ipynb' in a frame because 
it set 'X-Frame-Options' to 'SAMEORIGIN'

Here it says I should set some x-frame-header option for this: http://ipython.org/ipython-doc/dev/whatsnew/development.html#iframe-embedding

Where can I set this? How to change this X-Frame-Option so that it can be embedded from another site? :)


回答1:


Update

according to the comment by Harrison, it should be

c.NotebookApp.tornado_settings = {'headers': {'X-Frame-Options': 'ALLOW-FROM https://example.com/'}}

now, see also http://jupyter-notebook.readthedocs.io/en/stable/config.html

Original Post

Ok I found a solution that is working but I am not 100% sure if it is the right way to do it: In .ipython/your_profile/ipython_notebook_config.py add

c.NotebookApp.webapp_settings = {'headers': {'X-Frame-Options': 'ALLOW-FROM https://example.com/'}}

Works for me, but not sure if this overrides more settings from tornado or anything :)



来源:https://stackoverflow.com/questions/25327403/run-ipython-notebook-in-iframe-from-another-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!