KAKAK
KAKAK

Reputation: 899

Change default browser linux - Python

i want to change the default browser in ubuntu and the open a url

What is tried:

def makedefault():
    subprocess.call(('xdg-settings set default-web-browser google-chrome.desktop')
    webbrowser.get().open('http://google.com')

but it is launcing the url in firefox. Thanks for the help.

Btw when i run xgd command in terminal it changed the default url

Upvotes: 1

Views: 409

Answers (1)

Suku
Suku

Reputation: 3880

You can use google-chrome command to open a particular url in chrome via subprocess

google-chrome www.google.com

Note: If google-chrome is not in your PATH variable, use absolute path or add the path to PATH variable

Upvotes: 2

Related Questions