javascript - how can I run HTML5 doc with WebGL canvas on IPython notebook -


there nice tutorial on webgl @ link:

http://learningwebgl.com/blog/?p=571

and using example starting point question:

http://learningwebgl.com/lessons/lesson06/index.html

so runs nicely on browser. copied source , required libaries:

 - glmatrix.html  - webgl-utils.js 

on pc. can run them again on browser nicely.

in source html, these libaries referred external libraries this:

<script type="text/javascript" src=".\glmatrix.js"></script> <script type="text/javascript" src=".\webgl-utils.js"></script> 

they located in same directory source html, namely, kvbox.html.

now want run html within notebook cell. enter:

from ipython.core.display import html  def puthtml():      source = open("kvbox.html", "rb").read().decode()     return html(source)   puthtml() 

same screen there, without box , canvas. no error messages on output line on notebook.

when @ notebook server console see these errors:

[i 21:56:51.077 notebookapp] 302 /notebooks/.%5cglmatrix.js?_=1454010913066 (::1) 15.64ms [i 21:56:51.077 notebookapp] refusing serve hidden file, via 404 error [w 21:56:51.077 notebookapp] 404 /files/.%5cglmatrix.js (::1) 0.00ms referer =http://localhost:8888/notebooks/untitled4.ipynb?kernel_name=python3 [i 21:56:51.093 notebookapp] 302 /notebooks/.%5cwebgl-utils.js?_=14540109130 67 (::1) 0.00ms [i 21:56:51.093 notebookapp] refusing serve hidden file, via 404 error [w 21:56:51.093 notebookapp] 404 /files/.%5cwebgl-utils.js (::1) 0.00ms refe rer=http://localhost:8888/notebooks/untitled4.ipynb?kernel_name=python3 

i have googled , looked throgh including external libraries notebook. found noteook extensions given @ github. need solution own additions.

the nearest question item:

how add external javascript file in ipython notebook

so tried use %%html commands above mentioned external libraries. no erro on output line, same refusal error on console.

edit:

after reading , trying many different suggestions have not worked, had workaround. wrote simple include routine myself. merge library code source html, in "source" string above, , works fine.

the path separator character in url / not \. see the documentation.

your browser appears performing error recovery while ipython not.

hence getting 404 errors /files/.%5cglmatrix.js (%5c url encoded \) instead of 200 oks /files/glmatrix.js.

use correct url.


Comments