Two Methods to Determine What Browser is Installed
Keywords: netscape internet explorer browser
Question:
How do I determine what browser is installed on a given machine?Answer:
Here are two methods:
- In the first approach below, the Internet Shortcut file needs to have the following form (like an INI file):
[DEFAULT] BASEURL=http://www.whereever.com/somepage.htm [InternetShortcut] URL=http://www.whereever.com/somepage.htmaccomplished with the following code:temp=Environment("TEMP") if temp=="" then temp=Environment("TMP") if temp=="" then temp="C:\" where="http://www.yahoo.com/" if strsub(temp,strlen(temp),1)!="\" temp=strcat(temp,"\") endif url=strcat(temp,"$xyz.url") xxx=FileOpen(url,"WRITE") FileWrite(xxx,"[DEFAULT]") FileWrite(xxx,strcat("BASEURL=",where)) FileWrite(xxx,"[InternetShortCut]") FileWrite(xxx,strcat("URL=",where)) FileClose(xxx) ShellExecute(url,"","",@NORMAL,"OPEN")But I don't think NT 3.51 will pick up on that. You have to figure out the browser name and launch it like:run("c:\program files\netscape\communicator\programs\netscape.exe","http://www.yahoo.com")
- Or, another approach would be something like...
;WARNING WARNING NEVER NEVER ;JUST SET ERRORMODE(@OFF) AT THE TOP OF YOUR SCRIPT ;IT CAN PUT YOUR COMPANY OUT OF BUSINESS!!! ;MAKE SURE TO ISOLATE ITS USAGE AROUND A COUPLE OF LINES OF CODE, AS BELOW: Errormode(@off) ;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Netscape.exe netscape=RegQueryValue(@RegMachine,"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Netscape.exe[]") ;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE iexplorer=RegQueryValue(@RegMachine,"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE[]") ErrorMode(@CANCEL) if netscape!=0 run(netscape,"") else if iexplorer!=0 run(iexplorer,"") else Message("Ooopsie","Browser not found") endif endif exit
Article ID: W13346Filename: Determine what Browser is Installed.txt