NSIS: How to check if the default browser is Chrome

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

[code]
; 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
[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *