Issue #2666: Handle BROWSER environment variable properly for unknown browser names in the webbrowser module.
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index bfd353a..74f0270 100644
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -625,7 +625,9 @@
     # and prepend to _tryorder
     for cmdline in _userchoices:
         if cmdline != '':
-            _synthesize(cmdline, -1)
+            cmd = _synthesize(cmdline, -1)
+            if cmd[1] is None:
+                register(cmdline, None, GenericBrowser(cmdline), -1)
     cmdline = None # to make del work if _userchoices was empty
     del cmdline
     del _userchoices
diff --git a/Misc/NEWS b/Misc/NEWS
index f98706c..eea32c1 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -364,6 +364,9 @@
 Library
 -------
 
+- Issue #2666: Handle BROWSER environment variable properly for unknown browser
+  names in the webbrowser module.
+
 - Issue #6054: Do not normalize stored pathnames in tarfile.
 
 - Issue #6794: Fix Decimal.compare_total and Decimal.compare_total_mag: NaN