Displaying an HTML file with a JS inside an iPython notebook

Luis Miguel

I have a piece of code in an iPython notebook that programmatically generates a folder named 'sound' containing the following files: index.html, canvas.js, graph.js and style.css.

If I open index.html in my browser, I can see exactly the output I want: a graph with a nice JS animation representing vectors in and out of a process I am modeling.

network visualization

However, I would like to display the HTML file from inside the iPython notebook itself.

For that, I type the following code:

from IPython.display import IFrame
IFrame('/Users/useird/Desktop/sound/index.html', width=700, height=350)

Which returns the following: 404 error ipython notebook

I am not an expert with css or js, but I think that iPython can display js inside an iframe, so what's wrong here?

Thanks

Jakob

To explicitly answer this question, I post my comment here again.

IPython uses the Tornado web server engine to serve the html pages. Per default, the web server cannot access files above the start directory. Otherwise, this would be a severe security exposure. Hence, to make your data available for the web server you have to place it in the notebook starting directory or in a subdirectory.

This applies not only to html pages, but also to images you want to display using tags.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Import html to ipython notebook file

From Dev

Plot inside Ipython Notebook

From Dev

Plot inside Ipython Notebook

From Dev

ipython notebook startup file

From Dev

ipython notebook startup file

From Dev

Geopandas : displaying several layers on iPython notebook

From Dev

Jupyter (IPython) notebook: Convert an HTML notebook to ipynb

From Dev

Install new package from inside ipython Notebook

From Dev

Ipython Notebook - Latex inside markdown table

From Dev

Bokeh hover tooltip not displaying all data - Ipython notebook

From Dev

Displaying rotatable 3D plots in IPython or Jupyter Notebook

From Dev

How do I pass an array as parameter from Ipython notebook to an html file, which contains some javascript functions?

From Dev

Converting ipython notebook to html with separate images

From Dev

CSS Styling of HTML in IPython Notebook output

From Dev

Python dictionary as html table in ipython notebook

From Dev

Save output of ggplot in ipython notebook to file

From Dev

Cannot import .py file to ipython notebook

From Dev

IPython notebook won't read the configuration file

From Dev

Can you upload a data file in a ipython notebook

From Dev

Matplotlib: Save figure as file from iPython notebook

From Dev

Displaying text inside an HTML input

From Dev

Displaying a PHP variable inside JS

From Dev

Executing "python setup.py install" inside an iPython notebook

From Dev

How to force an automatic reload of the library from inside IPython notebook

From Dev

How to write html inside IPython Dialog box?

From Dev

Printing 2 Python Pandas DataFrame in HTML Tables in iPython Notebook

From Dev

IPython Notebook & Pandas: How does pandas produce html table?

From Dev

How to *not* display 'NaN' in ipython notebook (html table of pandas dataframe)?

From Dev

IPython Notebook: How to combine HTML output and matplotlib figures?

Related Related

  1. 1

    Import html to ipython notebook file

  2. 2

    Plot inside Ipython Notebook

  3. 3

    Plot inside Ipython Notebook

  4. 4

    ipython notebook startup file

  5. 5

    ipython notebook startup file

  6. 6

    Geopandas : displaying several layers on iPython notebook

  7. 7

    Jupyter (IPython) notebook: Convert an HTML notebook to ipynb

  8. 8

    Install new package from inside ipython Notebook

  9. 9

    Ipython Notebook - Latex inside markdown table

  10. 10

    Bokeh hover tooltip not displaying all data - Ipython notebook

  11. 11

    Displaying rotatable 3D plots in IPython or Jupyter Notebook

  12. 12

    How do I pass an array as parameter from Ipython notebook to an html file, which contains some javascript functions?

  13. 13

    Converting ipython notebook to html with separate images

  14. 14

    CSS Styling of HTML in IPython Notebook output

  15. 15

    Python dictionary as html table in ipython notebook

  16. 16

    Save output of ggplot in ipython notebook to file

  17. 17

    Cannot import .py file to ipython notebook

  18. 18

    IPython notebook won't read the configuration file

  19. 19

    Can you upload a data file in a ipython notebook

  20. 20

    Matplotlib: Save figure as file from iPython notebook

  21. 21

    Displaying text inside an HTML input

  22. 22

    Displaying a PHP variable inside JS

  23. 23

    Executing "python setup.py install" inside an iPython notebook

  24. 24

    How to force an automatic reload of the library from inside IPython notebook

  25. 25

    How to write html inside IPython Dialog box?

  26. 26

    Printing 2 Python Pandas DataFrame in HTML Tables in iPython Notebook

  27. 27

    IPython Notebook & Pandas: How does pandas produce html table?

  28. 28

    How to *not* display 'NaN' in ipython notebook (html table of pandas dataframe)?

  29. 29

    IPython Notebook: How to combine HTML output and matplotlib figures?

HotTag

Archive