I am trying to print a Javascript code to return the notebook URL.
I have the following written in a Jupyter Notebook cell:
%%javascript
var kernel = IPython.notebook.kernel
var host = window.location.href
kernel.execute("notebook_url='"+host+"'")
and when I query for notebook_url
it gives output as 'http://localhost:8889/notebooks/LTIBootCamp.ipynb'
But when I try the same from Jupyter Lab it gives the following error
from IPython.display import display, Javascript
display(Javascript(
'var kernel = IPython.notebook.kernel'
'var host = window.location.href'
'kernel.execute("notebook_url='"+host+"'")'
))
output error:
Javascript Error: unexpected token: identifier
Any suggestions how can can I do the same in JupyterLab?