How to change the default browser used by jupyter notebook in windows

In Windows, write in cmd/ Anaconda Prompt:

jupyter notebook --generate-config

The jupyter_notebook_config.py file generated is situated in "C:\Users\YourName\.jupyter\" folder.

Open it using a text editor and change #c.NotebookApp.browser = '' to

import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'))
c.NotebookApp.browser = 'chrome'

and save the file.

Now execute the jupyter-notebook command and the set browser will be used.


Thanks to @Darthbith and this post How to change the default browser used by the ipython/jupyter notebook in Linux? I was able to figure it out:

Step 1: To open Anaconda Prompt from the Start Menu and type

# for old notebook and JupyterLab < 3.0, or
jupyter notebook --generate-config
# for new nbclassic and JupyterLab >= 3.0
jupyter server --generate-config

This will generate the file ~/.jupyter/jupyter_notebook_config.py (or jupyter_server_config.py for nbclassic/new JupyterLab)

Step 2: Edit this file and change the following line (chrome is also is also in a local installation)

# for old notebook and JupyterLab < 3.0
c.NotebookApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'
# OR for new nbclassic and JupyterLab >= 3.0
c.ServerApp.browser = u'C:/Home/AppData/Local/Google/Chrome/Application/chrome.exe %s'

I don't know the precise details for Windows, but this is how to set the default browser on a Mac:

jupyter notebook --generate-config

This creates a file jupyter_notebook_config.py in ~/.jupyter. Edit the line

#c.NotebookApp.browser = ''

On a Mac I set it to:

c.NotebookApp.browser = u'open -a /Applications/Gooogle\ Chrome.app %s'

You just need to figure out how to point it to Chrome on Windows.


The following also works for me. I give it a full path to chrome, plus %s at the end.

jupyter notebook --browser='C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'

If chrome is in the PATH environment variable, the following might work too.

jupyter notebook --browser=chrome