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

Discussion in 'Python' started by Peter Otten, Sep 5, 2012.

  1. Peter Otten

    Peter Otten Guest

    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)
     
    Peter Otten, Sep 5, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. desktop
    Replies:
    2
    Views:
    483
    Victor Bazarov
    Jun 6, 2007
  2. ose

    Default type for "register" variable

    ose, Sep 1, 2007, in forum: C Programming
    Replies:
    3
    Views:
    339
    Gordon Burditt
    Sep 2, 2007
  3. Nemesis

    Register with a default Value

    Nemesis, Dec 18, 2008, in forum: VHDL
    Replies:
    16
    Views:
    5,407
    Ken Cecka
    Jan 9, 2009
  4. Bob from Chesham Bois

    Can using "register" make code non-reentrant?

    Bob from Chesham Bois, Jul 20, 2009, in forum: C++
    Replies:
    3
    Views:
    420
    Richard Herring
    Jul 20, 2009
  5. Mark Lawrence
    Replies:
    0
    Views:
    200
    Mark Lawrence
    Sep 5, 2012
Loading...

Share This Page