Skip to content

System default browser not used, because serverapp started as "opening a local html file" #1488

Open
@MichaelClerx

Description

@MichaelClerx

Description

On a fresh install of Fedora 41 (gnome 47) I suddenly found that the jupyter notebook command opened chrome, not my system default of firefox. This was really confusing as I couldn't see any configuration files, environment variables or anything else telling it to do this, and webbrowser.open('https://google.com') would load firefox as expected.

Reproduce

Fresh install of recent linux, including multiple browsers.
Change default browser

After a lot of searching, I discovered it was because the default browser used by webbrowser is xdg-open, which will use the system default browser for http://..., but the default application for the .html extension for local files file://....

And because jupyter was starting as
file:///home/michael/.local/share/jupyter/runtime/jpserver-10052-open.html
this was treated as a local "opening a html file" action...

This gets worse, because if you do web development you might want the local "opening a html file" to be opening it in a text editor...

Expected behavior

Expecting notebook to "open a page in the default browser".
Instead it "perfoms the default action for opening a local html file"

Obvious solution would be to use webbrowser.open('http://localhost:8888/tree?...
instead of getting there via a local file?

Context

Operating System and version: Fedora 41
Browser and version: Firefox and chrome
Jupyter Server version: 2.14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions