Opening a URL with Default Browser

suggest change

To simply open a URL, use the webbrowser.open() method:

import webbrowser
webbrowser.open("http://stackoverflow.com")

If a browser window is currently open, the method will open a new tab at the specified URL. If no window is open, the method will open the operating system’s default browser and navigate to the URL in the parameter. The open method supports the following parameters:

Note, the new and autoraise arguments rarely work as the majority of modern browsers refuse these commmands.

Webbrowser can also try to open URLs in new windows with the open_new method:

import webbrowser
webbrowser.open_new("http://stackoverflow.com")

This method is commonly ignored by modern browsers and the URL is usually opened in a new tab. Opening a new tab can be tried by the module using the open_new_tab method:

import webbrowser
webbrowser.open_new_tab("http://stackoverflow.com")

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents