By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,563 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

webbrowser.open_new alternatives for Windows

P: n/a
how can i open a _NEW_ browser window on Windows ?
(It should be browser independent. at least for IE, Mozilla &
Netscape)

i found a snippet/suggestion for "IE only" in this group but it
doesn't work, open also in old window:
from win32com.client import Dispatch
def start(url):
w=Dispatch("InternetExplorer.Application")
w.Navigate2(url)
w.visible=1
start("http://www.python.org")
start("http://www.zope.com")

Robert
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Robert wrote:
how can i open a _NEW_ browser window on Windows ?
(It should be browser independent. at least for IE, Mozilla &
Netscape)

i found a snippet/suggestion for "IE only" in this group but it
doesn't work, open also in old window:
from win32com.client import Dispatch
def start(url):
w=Dispatch("InternetExplorer.Application")
w.Navigate2(url)
w.visible=1
start("http://www.python.org")
start("http://www.zope.com")

Robert


Under Windows, you can use os.startfile() to start the application
associated with the file extension:
fname = 'c:/dev/python/_doc/python.html'
import os
os.startfile(fname)

You will launch a new browser instance for each os.startfile() and it
will launch the default browser, whatever it is.

Pierre

Jul 18 '05 #2

P: n/a
os.startfile opening new... : that not true with my current setup : py23 +
Mozills default (IE also):

only if moz not running, a quick 2-timer os.startfile like:
os.startfile("http://www.google.it"); os.startfile("http://www.google.de")
creates 2 windows. if moz already running, then it opens always in last
actived browser window ?

think also webbrowser.open(_new) does nothing else than os.startfile !?
did not find any suitable alternative for open_new. thats really a lack in
the lib and cannot imagine nooneelse needs that?

for moz i found: mozilla.exe -remote openURL('www.mozilla.org',new-tab)
www.mozilla.org
seems I have to scan registry and fiddle such stuff for the top5 of
browsers.

Does anybody know where the windows default brower is set officially in the
registry?

Robert

PS: the example > mozilla.exe -remote openURL('www.mozilla.org',new-tab)
www.mozilla.org < is supposed to open even in new tab! not completely new
window. however it opens always a new window. is this a mozilla bug?
"Pierre Rouleau" <pr******@impathnetworks.com> schrieb im Newsbeitrag
news:Z8********************@news20.bellglobal.com. ..
Robert wrote:
how can i open a _NEW_ browser window on Windows ?
(It should be browser independent. at least for IE, Mozilla &
Netscape)

i found a snippet/suggestion for "IE only" in this group but it
doesn't work, open also in old window:
from win32com.client import Dispatch
def start(url):
w=Dispatch("InternetExplorer.Application")
w.Navigate2(url)
w.visible=1
start("http://www.python.org")
start("http://www.zope.com")

Robert


Under Windows, you can use os.startfile() to start the application
associated with the file extension:
>>> fname = 'c:/dev/python/_doc/python.html'
>>> import os
>>> os.startfile(fname)

You will launch a new browser instance for each os.startfile() and it
will launch the default browser, whatever it is.

Pierre


Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.