| Exception raised when a browser control error occurs. |
| |
| The following functions are defined: |
| |
| |
| .. function:: open(url[, new=0[, autoraise=1]]) |
| |
| Display *url* using the default browser. If *new* is 0, the *url* is opened in |
n | the same browser window. If *new* is 1, a new browser window is opened if |
n | the same browser window if possible. If *new* is 1, a new browser window is |
| possible. If *new* is 2, a new browser page ("tab") is opened if possible. If |
| opened if possible. If *new* is 2, a new browser page ("tab") is opened if |
| *autoraise* is true, the window is raised if possible (note that under many |
| possible. If *autoraise* is true, the window is raised if possible (note that |
| window managers this will occur regardless of the setting of this variable). |
| under many window managers this will occur regardless of the setting of this |
| variable). |
| |
| Note that on some platforms, trying to open a filename using this function, |
| may work and start the operating system's associated program. However, this |
| is neither supported nor portable. |
| |
| .. versionchanged:: 2.5 |
| *new* can now be 2. |
| |
| |
| .. function:: open_new(url) |
| |
| Open *url* in a new window of the default browser, if possible, otherwise, open |
| would be nice; the :envvar:`KDEDIR` variable is not sufficient. Note also that |
| the name "kfm" is used even when using the :program:`konqueror` command with KDE |
| 2 --- the implementation selects the best strategy for running Konqueror. |
| |
| (2) |
| Only on Windows platforms. |
| |
| (3) |
n | Only on MacOS platforms; requires the standard MacPython :mod:`ic` module, |
n | Only on Mac OS platforms; requires the standard MacPython :mod:`ic` module. |
| described in the Macintosh Library Modules (XXX reference: ../mac/module- |
| ic.html) manual. |
| |
| (4) |
n | Only on MacOS X platform. |
n | Only on Mac OS X platform. |
| |
| Here are some simple examples:: |
| |
| url = 'http://www.python.org' |
| |
n | # Open URL in a new tab, if a browser window is already open. |
n | # Open URL in a new tab, if a browser window is already open. |
| webbrowser.open_new_tab(url + '/doc') |
| |
| # Open URL in new window, raising the window if possible. |
| webbrowser.open_new(url) |
| |
| |
| .. _browser-controllers: |
| |
| Browser Controller Objects |
| -------------------------- |
| |
n | Browser controllers provide two methods which parallel two of the module-level |
n | Browser controllers provide these methods which parallel two of the module-level |
| convenience functions: |
| |
| |
n | .. function:: open(url[, new[, autoraise=1]]) |
n | .. method:: controller.open(url[, new[, autoraise=1]]) |
| |
| Display *url* using the browser handled by this controller. If *new* is 1, a new |
| browser window is opened if possible. If *new* is 2, a new browser page ("tab") |
| is opened if possible. |
| |
| |
n | .. function:: open_new(url) |
n | .. method:: controller.open_new(url) |
| |
| Open *url* in a new window of the browser handled by this controller, if |
| possible, otherwise, open *url* in the only browser window. Alias |
| :func:`open_new`. |
| |
| |
t | .. function:: open_new_tab(url) |
t | .. method:: controller.open_new_tab(url) |
| |
| Open *url* in a new page ("tab") of the browser handled by this controller, if |
| possible, otherwise equivalent to :func:`open_new`. |
| |
| .. versionadded:: 2.5 |
| |