This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: webbrowser.open_new() opens in an existing browser window
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, bram_cohen, r.david.murray, theller
Priority: normal Keywords:

Created on 2003-09-24 22:38 by bram_cohen, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Messages (6)
msg18333 - (view) Author: Bram Cohen (bram_cohen) Date: 2003-09-24 22:38
I'm running Windows with Mozilla (version 1.4) as my
default web browser. When I call webbrowser.open_new()
using Python 2.3 it opens the url in an existing window
(if there are any) rather than opening a new one like
it's supposed to. This might in some way be an
interaction with tabbed browsing, since I always have a
bunch of tabs open.
msg18334 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-09-25 18:42
Logged In: YES 
user_id=11375

It's invoking Mozilla with -remote "openURL(http://example.com, 
new-window)".  

According to http://www.mozilla.org/unix/remote.html, this should create 
a new window.  Try to run this command yourself and set if it opens a 
new tab; if it does, this is a Mozilla bug (or perhaps a feature?).
msg18335 - (view) Author: Bram Cohen (bram_cohen) Date: 2003-09-26 01:34
Logged In: YES 
user_id=52561

This is very bizzare. When I execute this command -

C:\>"Program Files\mozilla.org\Mozilla\mozilla.exe" -remote
"openURL(http://www.bitconjurer.org/, new-window)"

it opens a new browser window with no page open in it. Are
you sure it's executing the command you said?
msg18336 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-09-26 11:39
Logged In: YES 
user_id=11375

Looking at the code. this is what webbrowser.py should be doing.  I can't 
debug this problem, because I'm not seeing it on my Linux box with 
Mozilla 1.4.  

I suggest you make a copy of webbrowser.py and insert debugging prints 
into it.  Is it instantiating the Netscape class, as I expect?  And what 
arguments is it really using?
msg18337 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2003-09-26 12:37
Logged In: YES 
user_id=11105

I can confirm (and possibly explain) everything that Bram
reports.

1. The '-remote' switch on the command line for mozilla only
works on Unix/Linux, as documented in
http://www.mozilla.org/docs/command-line-args.html. So
executing the command line

"Program Files\mozilla.org\Mozilla\mozilla.exe" - remote
"openURL(...)"

doesn't load this url, it only starts mozilla.

2. webbrowser.py on Windows (for me at least) doesn't
instantiate the Netscape class - it uses WindowsDefault,
which simply uses startfile(url). So, the 'new' and
'autoraise' arguments are not even used.

Looking at the docs for the webbrowser module, the words 'if
possible' are used very often. So it seems, it simply is not
possible on windows.

(The only thing which should be fixed in the docs is that
the win32api and win32con modules are mentioned, but they
are not used in the code - so this should be removed IMO).

I suggest to close the bug if noone comes up with a patch.
msg108432 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-06-23 02:14
Note: the -remote switch actually works on windows firefox (just tested on 3.6).
History
Date User Action Args
2022-04-10 16:11:20adminsetgithub: 39293
2010-06-23 02:14:57r.david.murraysetnosy: + r.david.murray
messages: + msg108432
2003-09-24 22:38:50bram_cohencreate