Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still can't be set as the default browser for http and https #166

Open
ednykissyou opened this issue Aug 24, 2024 · 1 comment
Open

Still can't be set as the default browser for http and https #166

ednykissyou opened this issue Aug 24, 2024 · 1 comment

Comments

@ednykissyou
Copy link

Still can't be set as the default browser for http and https.
Win 11 64X

Only apps can be selected, but there is no brave in it.
The green version doesn't generate apps?
2024.08.24

@Huiaei
Copy link

Huiaei commented Nov 26, 2024

I found a VBS file online for registering applications in the registry. I have made some slight modifications to it, hoping it will be helpful to you.
I haven't carefully read through this VBS file; perhaps you could take a thorough look at it.
If your usage scenario involves using it on USB drives or other mobile storage devices, I wouldn't advise using this file. I only used it after storing Brave in local storage.
The VBS is very simple to use; just place it in the same directory as your Brave Portable's brave-portable.exe and then open this file.

'Registers Brave Portable with Default Programs or Default Apps in Windows
'Forked from chromeportable.vbs - created on May 20, 2019 by Ramesh Srinivasan, Winhelponline.com
'v1.1 13-Jun-2019 - Enclosed file name parameter in double-quotes.
'v1.2 10-Sep-2020 - Fixed ApplicationIcon path. And added other supported URL protocols.
'v2.0 05-Dic-2020 - Change from Chrome to Brave

Option Explicit
Dim sAction, sAppPath, objFile, oFSO, sbaseKey, sbaseKey2
Dim WshShell : Set WshShell = CreateObject("WScript.Shell") 
Dim oFS0 : Set oFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = oFSO.GetFile(WScript.ScriptFullName)
sAppPath = oFSO.GetParentFolderName(objFile)
sAppPath = sAppPath & "\brave-portable.exe"

If Not oFSO.FileExists (sAppPath) Then WScript.Quit
If InStr(" ", sAppPath) = 0 Then sAppPath = """" & sAppPath & """"

If WScript.Arguments.Count > 0 Then
   If UCase(Trim(WScript.Arguments(0))) = "-REG" Then Call RegisterBravePortable(sAppPath)
   If UCase(Trim(WScript.Arguments(0))) = "-UNREG" Then Call UnregisterBravePortable(sAppPath)
Else
   sAction = InputBox("Type REGISTER to add Brave Portable to Default Apps. Type UNREGISTER to remove.", "Brave Portable Registration", "REGISTER")
   If UCase(Trim(sAction)) = "REGISTER" Then Call RegisterBravePortable(sAppPath)
   If UCase(Trim(sAction)) = "UNREGISTER" Then Call UnregisterBravePortable(sAppPath)
End If

Sub RegisterBravePortable(sAppPath)
   sbaseKey = "HKCU\Software\"
   sbaseKey2 = sbaseKey & "Clients\StartmenuInternet\Brave Portable\"
   
   WshShell.RegWrite sbaseKey & "RegisteredApplications\Brave Portable", "Software\Clients\StartMenuInternet\Brave Portable\Capabilities", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\", "Chrome HTML Document", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\AppUserModelId", "Brave Portable", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\AppUserModelId", "Brave Portable", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationIcon", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationName", "Brave Portable", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationDescription", "Access the internet", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationCompany", "UnGoogled Inc.", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\DefaultIcon\", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\shell\open\command\", sAppPath & " " & """" & "%1" & """", "REG_SZ"
   
   WshShell.RegWrite sbaseKey2, "Brave Portable Edition", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationDescription", "Brave Portable Edition", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationIcon", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationName", "Brave Portable Edition", "REG_SZ"   
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.htm", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.html", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.shtml", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.xht", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.xhtml", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.webp", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\ftp", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\http", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\https", "ChromeHTML2", "REG_SZ"   
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\irc", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\mailto", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\mms", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\news", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\nntp", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\sms", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\smsto", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\tel", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\url", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\webcal", "ChromeHTML2", "REG_SZ"  
   WshShell.RegWrite sbaseKey2 & "DefaultIcon\", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "shell\open\command\", sAppPath, "REG_SZ"

   'Launch Default Apps after registering Brave Portable   
   WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram"  
End Sub


Sub UnregisterBravePortable(sAppPath)
   sbaseKey = "HKCU\Software\"
   sbaseKey2 = "HKCU\Software\Clients\StartmenuInternet\Brave Portable"   

   On Error Resume Next
   WshShell.RegDelete sbaseKey & "RegisteredApplications\Brave Portable"
   On Error GoTo 0
   
   WshShell.Run "reg.exe delete " & sbaseKey & "Classes\ChromeHTML2" & " /f", 0
   WshShell.Run "reg.exe delete " & chr(34) & sbaseKey2 & chr(34) & " /f", 0
   
   'Launch Default Apps after unregistering Brave Portable   
   WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram"   
End Sub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants