Register a portable browser and make it the default

i promised, that i will show you how to register a portable browser to the system and even make it the default. sorry, that it took so long, but here you go! we will use Opera portable for this case, but you can easy adapt this method for any browser. this should also work with App-V or ThinApp packaged browsers.

first of all, we want our browser to show up in the Window settings app, but since the browser is not installed, we need to add some registry keys to make it appear.

since we dont want to install the browser at all, we will add any changes to the registry only under the HKEY_CURRENT_USER and nothing under HKEY_LOCAL_MACHINE!

Microsoft actually has an article about this procedure and even states, that HKEY_CURRENT_USER has predescence over HKEY_LOCAL_MACHINE, but that doesnt matter in our case. you can find Microsoft’s official document here: https://docs.microsoft.com/en-us/windows/desktop/shell/start-menu-reg

basically we need to do following changes to the registry to make the browser show up: (it would even work without all of them, but we better make it complete – you never know what Microsoft will do in the future with non compliant registry entries)

  • register our browser at HKCU\Software\RegisteredApplications
  • register our handler at HKCU\Software\Classes
  • register the browser with the handler at HKCU\Software\Clients\StartMenuInternet

before we start now, we need to define a name and a file/protocol handler for our browser. in this case i will just use following:

  • the name will be OperaPortable
  • the handler (aka. ProgID) will be OperaPortableHTM (this is how Chrome does it btw)

you can use different handlers for every protocol or filetype the browser supports, but this makes it just more complicated. Windows does only register four things when you change the default browser (the rest is optional):

  • .htm and .html get associated with the browser
  • http and https are being associated with the browser

nowadays most browsers can handle much more (pdf, mailto, etc.), but thats the minimum required to Windows think it is the default browser.

to simplify the example, i have placed the binaries of the portable Opera to C:\Portable – but this doesnt really matter as long its a path that the user can access.

lets get started to register it in the first location:

Windows Registry Editor Version 5.00 

[HKEY_CURRENT_USER\Software\RegisteredApplications] "OperaPortable"="Software\Clients\StartMenuInternet\OperaPortable\Capabilities"

this will do nothing yet, but tells Windows that there is a new RegisteredApplication with certain capabilities. we need to add the needed information as described in the Microsoft article now (make sure the path includes double backslashes):

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable]
@="Opera Portable"
[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\Capabilities]
"ApplicationDescription"="Opera Portable"
"ApplicationIcon"="C:\\Portable\\Opera\\58.0.3135.47\\opera.exe,0"
"ApplicationName"="Opera Portable"
[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\Capabilities\FileAssociations]
; you can add additional filetypes like .pdf if your browser supports it
".htm"="OperaPortableHTM"
".html"="OperaPortableHTM"
[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\Capabilities\Startmenu]
"StartMenuInternet"="OperaPortable"
[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\Capabilities\URLAssociations]
; you can add additional protocols like mailto for example
"http"="OperaPortableHTM"
"https"="OperaPortableHTM"
[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\DefaultIcon]
@="C:\\Portable\\Opera\\58.0.3135.47\\opera.exe,0"

[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\shell]

[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\shell\open]

[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\shell\open\command]
@="\"C:\\Portable\\Opera\\58.0.3135.47\\opera.exe\""

as you can see, we used the handler and the browser name to have a unique entry. we have now a RegisteredApplication and a Startmenu entry, but we are still missing the handler for everything. lets add that now:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\OperaPortableHTM]
@="OperaPortable Handler"
"AppUserModelId"="OperaPortable"

[HKEY_CURRENT_USER\Software\Classes\OperaPortableHTM\Application]
"AppUserModelId"="OperaPortable"
"ApplicationIcon"="C:\\Portable\\Opera\\58.0.3135.47\\opera.exe,0"
"ApplicationName"="OperaPortable"
"ApplicationDescription"="Browse the web"
"ApplicationCompany"="Opera Portable"

[HKEY_CURRENT_USER\Software\Classes\OperaPortableHTM\DefaultIcon]
@="C:\\Portable\\Opera\\58.0.3135.47\\opera.exe,0"
[HKEY_CURRENT_USER\Software\Classes\OperaPortableHTM\shell]
[HKEY_CURRENT_USER\Software\Classes\OperaPortableHTM\shell\open]
[HKEY_CURRENT_USER\Software\Classes\OperaPortableHTM\shell\open\command]
; your browser might offer different arguments here - %1 opens just the argument given
@="\"C:\\Portable\\Opera\\58.0.3135.47\\opera.exe\" \"%1\""

and now we even can see our browser in the Windows settings app and can select it as a default browser!

if we run now SetDefaultBrowser, we also can select our portable browser!

running “SetDefaultBrowser.exe hkcu OperaPortable” will now make it our default browser for this current user!

if you get a “keep using this app” dialog, even after using SetDefaultBrowser, you should disable the new app notification “feature” from Windows with this registry key (needs a relogin or relaunch of explorer.exe):

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer]
"NoNewAppAlert"=dword:00000001

and thats it! like this you can add ANY browser to the current users profile and even make it the default!

if you want to script this, you simply can convert the .reg files to powershell with this website: https://reg2ps.azurewebsites.net/

Be the first to comment

Leave a Reply