Hopefully, you have seen that the Jupyter ecosystem has changed a lot in the last year or so. If not , go here and look at the bottom half of my reply there. What you are asking about pertains to Jupyter Notebook 7+ and JupyterLab being on JupyterLab components. Most of the posts you find on the internet pertain to older versions of Jupyter.
This example you first invoke using IPython.notebook.kernel.execute()
is indeed one of the things that has changed. This is has been covered here on this forum already here and here.
See also:
- Example snippet related to Javascript and use of
jupyterapp c.LabApp.expose_app_in_browser
- There is
kernel.execute_code()
, see here - example snippet using
ipylab
to run code (I link to some otheripylab
-related snippets here and here) - Running Javascript from a notebook in JupyterLab and another example here
- My comments below a question about keeping an interactive SVG interactive in JupyterLab v4+ and Jupyter Notebook 7+, that mention use of
%load_ext ipyreact
that worked in those versions of the current Jupyter tech to display confetti over the browser page using code inside Jupyter. - Basic tests of Javascript working in modern Jupyter are possible using the
console.log
andalert
systems, see more about that with example code here, here, and here.