470,591 Members | 1,446 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

webbrowser.open_new alternatives for Windows

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
2 2521
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
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.

Similar topics

reply views Thread by andrea.gavana | last post: by
reply views Thread by Sharon | last post: by
19 posts views Thread by Blair P. Houghton | last post: by
2 posts views Thread by Ehsan | last post: by
11 posts views Thread by Anil Gupte | last post: by
2 posts views Thread by Antonio Ceballos | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.