How to use a different default browser for different websites

Posted by


Some websites that you use regularly will work better in a certain browser. Whether it be age-old corporate intranets that work better in Internet Explorer or modern web apps that work better in Chrome.


The concept is pretty simple. You create something that launches browsers based on the criteria you specify and set it as your default browser. It is launched whenever you click a http/https link and it, in turn, launches the desired browser.

The New Default Browser

I chose to write this as a Batch script as this seemed quickest. My Batch knowledge is pretty non-existent so it’s probably not very good. It’d be better written in something like C# as you wouldn’t get the very brief cmd popup every time you click a link. Here’s the code:

@setlocal enableextensions enabledelayedexpansion
@echo off
set tehurl=%1
set res=false

if not x%tehurl:// set res=true
if not x%tehurl:// set res=true
if not x%tehurl:// set res=true

if "%res%"=="true" (
    start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "%1"
) else (
    start "" "C:\Program Files (x86)\Opera\opera.exe" "%1"


You’ll see a list of domain names and two browser launchers – Chrome and Opera. The concept is that the listed URLs launch in Chrome and everything else in Opera. The URLs are specified in the format // so as to match http(s)://

Changing The Default Browser in Windows

This requires some registry hacking. This article summarizes the process well. Firstly you need to create a class which contains the details of your new browser. Classes are found in the Windows registry at HKEY_CURRENT_USER\Software\Classes. Hopefully you can find the class for your current default browser to copy however it’s as simple as creating a new REG_SZ key called something like HKEY_CURRENT_USER\Software\Classes\Phil.Protocol\shell\open\command with a value of “path to your browser” “%1”. The %1 is important such that the clicked URL is passed through to your script. Screenshot below:

Screenshot of registry configuration for a browser class
Screenshot of registry configuration for a browser class

Once a class is created, you must associate it with the http and https protocols. You do this by setting the class name into the Progid key at HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http and HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https respectively. Screenshot below:

Screenshot of registry configuration for default browser
Screenshot of registry configuration for default browser


You should immediately see that when you click a link, for example, in an e-mail it’ll launch the desired browser.

One comment

  1. Have you developed an app for us folks who are afraid to attempt do what you suggest? You describe exactly what I would like to accomplish. I use Edge, ie and Chrome. Each function better than the other for different websites.

Leave a Reply

Your email address will not be published.