Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28517 > unrolled thread

Re: how can i register the non-default browser with the webbrowser module?

Started byPeter Otten <__peter__@web.de>
First post2012-09-05 18:09 +0200
Last post2012-09-05 18:09 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: how can i register the non-default browser with the webbrowser module? Peter Otten <__peter__@web.de> - 2012-09-05 18:09 +0200

#28517 — Re: how can i register the non-default browser with the webbrowser module?

FromPeter Otten <__peter__@web.de>
Date2012-09-05 18:09 +0200
SubjectRe: how can i register the non-default browser with the webbrowser module?
Message-ID<mailman.251.1346861389.27098.python-list@python.org>
Levi Nie wrote:

> how can i register the non-default browser with the webbrowser module?
> 
> the case:
> i want open a site such as "google.com" in ie8 with the python.But my
> default is chrome.
> so i want to register a ie8 controller with the
> webbrowser.register(*name*, *constructor*[, *instance*]).
> so what does the parameter "constructor" "instance" mean?
> how can i do it?

Isn't there already a controller for ie8? I can't check, but you can list 
the available browsers with

>>> import webbrowser
>>> list(webbrowser._browsers)
['x-www-browser', 'kfmclient', 'firefox', 'konqueror']

Then if you want to open a page with a specific browser just do

url = "http://www.python.org"
browser = "firefox"
webbrowser.get(browser).open(url)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web