Jacobo de Vera
Jacobo de Vera

Reputation: 1933

How do I set a python program as the default Web browser in Windows?

I have a small python program that takes a URL and sends it to a neighbouring machine, which has a server that receives URLs and opens them in the browser.

My next step is to register this python program as the default browser in the local Windows box so that it gets the URLs when I click on links anywhere (Chat software, email clients, other applications).

How does one register a custom application as the default Web browser in windows?

Additional questions: What are the minimum requirements for this? Can I revert it back to the previous value? Is there a python library for that?

Upvotes: 1

Views: 299

Answers (1)

Adrian McCarthy
Adrian McCarthy

Reputation: 47952

The answer depends on the version of Windows. In the olden days, you had to tinker in the registry. In newer versions, you could change the http protocol association with an interface or two. Then you could only propose an association through a different API and get the user to take action to confirm it. In the newest versions of Windows, they've made it virtually impossible to change certain kinds of defaults to protect the users from a war of defaults being waged by competing applications.

If this is a one-off, I would just set it manually through the Default Programs control panel applet that's included in current versions of Windows.

If you want to attempt it programmatically, this seems like a good entry point into the documentation.

Upvotes: 2

Related Questions