New submission from David Steele:

When calling webbrowser.open*(), the module goes through a list of installed 
browsers, and uses the first one that succeeds, to process the request.

The first 'browsers' in the 'X' list are 'xdg-open' and others of that ilk. The 
problem is that they only have one 'open' behavior - the 'new' parameter is 
ignored ('same window', 'new window', 'new tab').

I can get the fully supported default browser in GNOME with e.g.

def browser():
    app = Gio.app_info_get_default_for_type('x-scheme-handler/https', True)
    bpath = app.get_filename()

    for candidate in webbrowser._tryorder:
        if candidate in bpath:
            return webbrowser.get(using=candidate)

    return webbrowser.get()


... but this code accesses a private list.

The problems are:

1) webbrowser does not determine and return the current default browser.

2) There is no public interface for determining the current/installed browser 
type list.


The problem can be mitigated by resolving (1) and/or (2).


Also, the browser type list in the documentation is missing many entries.

Checked on 2.7 and 3.4. I believe this is valid across all supported versions.

----------
messages: 243590
nosy: daves
priority: normal
severity: normal
status: open
title: webbrowser (very often) doesn't support the 'new' parameter
type: behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24241>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to