Register a portable browser and make it the default

INFORMATION: Please note that this article is obsolete, because I have created a tool that can automate this process: https://kolbi.cz/blog/2024/05/31/regportbro-register-portable-browser/

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/

7 Comments

  1. Thanks so much for this tutorial, it was just what I was looking for.
    I couldn’t get regedit to take the top code (I made a reg file), so I manually typed it in. Then I realized it needed the double backslashes for reg file.

  2. Thanks, but some questions:

    1.) Does this work for Window 7 as well?

    2.) Am I forced to put the ApplicationRegistration into StartMenu section
    [HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable]

    I want to avoid to have another StartMenu and want to put it into:
    [HKEY_CURRENT_USER\Software\Clients\PortableFirefox]

    3.) It seems to me that only *.htm and *.html extensions are handled/assigned.
    What about *.URL bookmark favorite files?
    When I double click on such a favorite files in WinExplorer the corresponding Webpage should be opened in Firefox Portable.

    Peter

    • adding a browser should work in windows 7 too, but on windows 7 you cannot use SetDefaultBrowser or SetUserFTA, since they are not needed. you can assign filetypes directly in the registry on win7.

      additional filetypes like .url can be added under the key HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaPortable\Capabilities\FileAssociations and then assigned to the corresponding ProgID. if you are on win8 or newer, you can use SetUserFTA for that.

  3. Thank you very much for your tutorial and the setDefaultBrowser Tool!
    I have two Questions:
    1.) Does the setDefaultBrowser.exe returns specific exit codes and if so what are they and what are they standing for?
    2.) What do you think about the method that is mentioned here:
    https://www.bleepingcomputer.com/news/microsoft/how-to-replace-windows-10-system-programs-with-non-microsoft-apps/
    Could this be an alternative way without the need for your tool?
    Regards
    markus

    • – SetDefaultBrowser returns error strings when something went wrong. all of them begin with error: – no error codes are being returned in the current version
      – the method described on this article needs administrative permissions and will override it for all users on the same machine. my tools work without admin privileges and will only change the associations for the current user (which is something you cannot do with microsoft methods, thats why i developed them)

Leave a Reply