472,805 Members | 933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

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 2624
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
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
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
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
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
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
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
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
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
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.