473,509 Members | 8,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2655
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
955
by: andrea.gavana | last post by:
Hello NG, I am using the webbrowser module (on Windows 2000/XP), and I am wondering if anyone knows how to use the input arguments "new". On Windows, it seems to be ignored. By looking at the...
0
1850
by: Sharon | last post by:
Hi all. I'm using the WebBrowser class and sometimes i get this exception: System.Windows.Forms.IWebBrowser2.Navigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData,...
19
2343
by: Blair P. Houghton | last post by:
I'm just learning Python, so bear with. I was messing around with the webbrowser module and decided it was pretty cool to have the browser open a URL from within a python script, so I wrote a...
1
3285
by: L. Chernov | last post by:
Hello, I am trying to work with .Net 2005 WebBrowser object, and put it on a "Windows control library" (embedded in a user control class) and then I am executing it from an ASP.Net webform(with...
2
1434
by: Ehsan | last post by:
Hi, does anyone know how to ask the System.Windows.Forms.WebBrowser object not to load the page's images? I just want the text returned from a web page. Are there any alternatives to using...
11
2800
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
4
3734
by: Gregory Bloom | last post by:
I'm running Python 2.5 under Windows. If I fire up IDLE and enter: it works like a champ, opening the page in Firefox. Same thing goes from a Windows cmd shell: it works as advertised. But...
2
2555
by: Antonio Ceballos | last post by:
Hello, I am trying to open a URL on a new browser or new tab from an HTML page created from a python cgi script. On Apache in my localhost, it works, both with Internet Explorer and Firefox....
3
9420
by: TedTrippin | last post by:
Hi, Background - I've create a windows application in VS and added a WebBrowser component and all works well. I'm now trying to do this programmatically. My application now listens on a socket...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7073
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.