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.
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:
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
open the jupyter notebook. Go to Files > Download as > HTML or PDF via LaTeX. Then check your Downloads folder for the file.
Jupyter Notebooks are documents that contain a mix of live code (Python, R, Julia, JavaScript, and more), visualizations, and narrative text (Markdown).
Jupyter Notebook Markdown allows you to use raw HTML in Markdown cells.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With