NSIS: How to check if the default browser is Chrome

Reading the registry key won’t cut it. This does.

; isDefaultBrowserChrome
!define isDefaultBrowserChrome "!insertmacro isDefaultBrowserChrome"

!macro isDefaultBrowserChrome Result

   FileOpen $0 "$PLUGINSDIR\browser_detect.htm" "w"
   FileClose $0
   System::Call "Shell32::FindExecutable(t '$PLUGINSDIR\browser_detect.htm', i 0, t .r1)"
   ${StrLoc} $0 $1 "chrome.exe" ">"
   ${If} $0 != ""
       StrCpy ${Result} "1"
   ${Else}
       StrCpy ${Result} "0"
   ${EndIf}

!macroend
Did this help you? Tip $1 Tip $2 Tip $5

Leave a Reply