0

while coding a Python-based AI when we are to access the internet through it. The Default web browser opens is Internet Explorer. How to get chrome as default?

  • It would help if you provided at least a sample of the code used for opening the browser. – matszwecja Aug 31 '21 at 07:20
  • I think changing your default browser on your OS should fix this. If you're using anaconda/jupyter, use [this](https://stackoverflow.com/questions/47772157/how-to-change-the-default-browser-used-by-jupyter-notebook-in-windows). – Noufal Ibrahim Aug 31 '21 at 07:41
  • Please provide enough code so others can better understand or reproduce the problem. – Community Sep 02 '21 at 17:22

1 Answers1

1

I don't know the specifics of how your AI framework opens a browser nor the operating system you are using. I am using windows 10 and have installed Chrome in the default location.

Changing your default browser using the operating system, may work:

  • Open Default apps
  • Under Web browser, select the browser currently listed, and then select Google Chrome

Or you can use this method - it works even if chrome isn't your default browser:

import webbrowser

url = 'https://www.python.org'
path = 'C:/Program Files/Google/Chrome/Application/chrome.exe'
webbrowser.register('mybrowser', None, webbrowser.BackgroundBrowser(path))
webbrowser.get('mybrowser').open(url)

You can fetch the location of the chrome executable from the registry with the key:

HKML\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe

Or find it using the shell command:

dir /s /b \chrome.exe

See also:
How to change the default browser used by jupyter in windows
How to change the default browser used by jupyter in Linux
Change your default browser in Windows 10

GoWiser
  • 857
  • 6
  • 20