summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2023-04-04 16:00:03 (GMT)
committerGitHub <noreply@github.com>2023-04-04 16:00:03 (GMT)
commitfd1947ecfba589feebd48c1ebb60d1c01ee0a89d (patch)
treecbb4f8399f992f1f5b9ca18e09cfaa5234c95985 /Lib/webbrowser.py
parent89e6a3446184925ee7f17cd0d948c7784a88b8d7 (diff)
downloadcpython-fd1947ecfba589feebd48c1ebb60d1c01ee0a89d.zip
cpython-fd1947ecfba589feebd48c1ebb60d1c01ee0a89d.tar.gz
cpython-fd1947ecfba589feebd48c1ebb60d1c01ee0a89d.tar.bz2
bpo-44844: Enable detection of Microsoft Edge browser in webbrowser module (GH-29908)
Diffstat (limited to 'Lib/webbrowser.py')
-rwxr-xr-xLib/webbrowser.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index d98c599..b86d131 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -400,6 +400,16 @@ class Konqueror(BaseBrowser):
return ok
+class Edge(UnixBrowser):
+ "Launcher class for Microsoft Edge browser."
+
+ remote_args = ['%action', '%s']
+ remote_action = ""
+ remote_action_newwin = "--new-window"
+ remote_action_newtab = ""
+ background = True
+
+
#
# Platform support for Unix
#
@@ -456,6 +466,10 @@ def register_X_browsers():
register("opera", None, Opera("opera"))
+ if shutil.which("microsoft-edge"):
+ register("microsoft-edge", None, Edge("microsoft-edge"))
+
+
def register_standard_browsers():
global _tryorder
_tryorder = []
@@ -487,6 +501,8 @@ def register_standard_browsers():
"opera", edge64, edge32):
if shutil.which(browser):
register(browser, None, BackgroundBrowser(browser))
+ if shutil.which("MicrosoftEdge.exe"):
+ register("microsoft-edge", None, Edge("MicrosoftEdge.exe"))
else:
# Prefer X browsers if present
if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"):