In these two links, https://stackoverflow.com/questions/47772157/how-to-change-the-default-browser-used-by-jupyter-notebook-in-windows, https://stackoverflow.com/questions/35229604/how-to-change-the-default-browser-used-by-the-ipython-jupyter-notebook-in-linux?rq=1, we can change default browser of ipython/jupyter notebook. But how to do this in IJulia?
IJulia only provides kernel, Jupyter server / application has it’s own config and we simply call it.
I imagine one simple way is to change your system’s default URL opening browser, on linux it amounts to something like
xdg-settings set default-web-browser firefox.desktop
As @jling mentioned, IJulia just sets the Julia kernel. Changing the default browser has nothing to do with the IJulia installation. On Windows, it is very easy to make that change:
click on settings
→ search for browser
→ choose the default web browser
This is definitely not what I mean. You could check those links for IPython cases. They change the launching browser only for python, not for the whole system.
We know that if not change default IJulia browser but just copy local jupyter link to another browser, one have to input some “password” and this forbid us to access through another browser locally since we don’t know any so called “password”. The only way is changing default setting in IJulia.
As said above,
So the information in your links is still relevant for the IJulia situation to configure web browsers (registration of names and so on).
If you are launching from a script, you can write do something (although fragile) from Julia like:
using IJulia
browser="safari" # specify your browser name: see https://docs.python.org/3/library/webbrowser.html#webbrowser.register
cmd = `$(IJulia.JUPYTER) notebook --browser=$(browser)`
run(Cmd(cmd; detach=true, dir=homedir()); wait=false) # change keyword arguments as needed.
I followed your method, but it doesn’t work. If I only input codes you showed, notebook would not be launched. And if I input notebook()
, IJulia will still open jupyter in default browser.
julia> using IJulia
julia> browser="google-chrome"
"google-chrome"
julia> cmd = `$(IJulia.JUPYTER) notebook --browser=$(browser)`
`'C:\Users\.julia\conda\3\Scripts\jupyter.exe' notebook --browser=google-chrome`
julia> run(Cmd(cmd; detach=true, dir=homedir()); wait=false)
Process(setenv(`'C:\Users\.julia\conda\3\Scripts\jupyter.exe' notebook --browser=google-chrome`; dir="C:\\Users\\mymoo"), ProcessRunning)
julia> notebook()