webbrowser.py currently uses Internet Explorer as the fallback browser on Windows, if the user has not set a default browser.
# Detect some common Windows browsers, fallback to IE
iexplore = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"),
"Internet Explorer\\IEXPLORE.EXE")
for browser in ("firefox", "firebird", "seamonkey", "mozilla",
"netscape", "opera", iexplore):
if shutil.which(browser):
register(browser, None, BackgroundBrowser(browser))
I propose to update this code to point directly to Microsoft Edge, for the following reasons:
-IE is deprecated and no longer functional on most Windows installations today.
-Any Windows installation with current Python has had Microsoft Edge installed since release.
-It seems that certain enterprise policies will block the user from directly invoking IE (See this Github issue).
Here is my idea of how to implement this. edge32 is the installation directory for 32 bit windows. I am not sure if it’s really necessary to define as 32bit windows is also deprecated and market share data indicates it’s extremely low and shrinking.
# Detect some common Windows browsers, fallback to Edge
edge = os.path.join(os.environ.get("PROGRAMFILES(x86)", "C:\\Program Files (x86)"),
"Microsoft\\Edge\\Application\\msedge.exe")
edge32 = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"),
"Microsoft\\Edge\\Application\\msedge.exe")
for browser in ("firefox", "firebird", "seamonkey", "mozilla", "opera", edge, edge32):
if shutil.which(browser):
register(browser, None, BackgroundBrowser(browser))
This is my first time contributing an idea so any thoughts/suggestions/feedback is welcome. Is this worth creating a PR for?
As an aside, webbrowser.py contains handling for some ancient browsers (Mosaic, Netscape, Grail) with comments indicating they are rarely still used even in 2005. Should the handling for these be removed?
# Next, Mosaic -- old but still in use.
if shutil.which("mosaic"):
register("mosaic", None, BackgroundBrowser("mosaic"))
# Grail, the Python browser. Does anybody still use it?
if shutil.which("grail"):
register("grail", Grail, None)