Jump to content

Testing for Default Browser


Recommended Posts

I need a bit of help - is there a way to test to see if Internet Explorer is set as the default browser? We have a few applications that require ActiveX and therefore Internet Explorer and I would like to change my current installation script to display a message if the user has anything other than IE as their default browser - I don't want to change it for them, just let them know that some applications will not work correctly without IE as the default browser.

Thanks in advance for any assistance. :mellow:

Link to comment
Share on other sites

Here is a good description which registry values you need to check: http://newoldthing.wordpress.com/2007/03/23/how-does-your-browsers-know-that-its-not-the-default-browser/ or ask Google :mellow:

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

You can try this

ConsoleWrite ( "-->-- Defaut Browser Path : " & _GetDefaultBrowser ( ) & @Crlf )

Func _GetDefaultBrowser ( )
    $_DefautBrowser = StringRegExp ( RegRead ( "HKEY_CLASSES_ROOT\http\shell\open\command", "" ), '(?s)(?i)"(.*?)"', 3 )
    If Not @error Then Return $_DefautBrowser[0]
EndFunc ;==> _GetDefaultBrowser ( )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

I may as well throw in my 2 cents

ConsoleWrite("IE is default = " & _IEisDefault() & @CRLF)

Func _IEisDefault()
    Return StringRegExp(RegRead("HKCR\http\shell\open\command", ""), "(?i)^.+iexplore\.exe.+$", 0)
EndFunc
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Yes, I had better correct that. StringInStr will work but not with a single call making the return.

In his case StringInStr() would return 37. I want it to return 1 or 0 and still do it in a single call.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

If I read that article correctly, win xp sets the default browser for (edit)all users :mellow:

Here;s what I got got 7 and vista.

MsgBox(0, 0, _DefaultBrowser())


Func _DefaultBrowser()
    ;TODO Get path for winxp
    If @OSVersion = "WIN_7" Or @OSVersion = "WIN_VISTA" Then
        $sRegPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice\"
    Else
        Return "WIN_XP"
    EndIf
    Return StringReplace(RegRead($sRegPath, "Progid"), "URL", "")
EndFunc   ;==>_DefaultBrowser
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Yes, I had better correct that. StringInStr will work but not with a single call making the return.

In his case StringInStr() would return 37. I want it to return 1 or 0 and still do it in a single call.

Bad excuse for more complicated (harder to read, and slower) code. There is no 1 vs. 0 requirement. Function success: Non-zero. Failure: Zero. Very C++. Edited by Manadar
Link to comment
Share on other sites

Then write it in C++. It won't bother me one bit.

Harder to read? Slower? Hmmmmmm, maybe not.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 1 year later...

I appreciate that this is an old post but thought that any others stuggling to find a solution to this might appricate the solution I have come up with after much searching, playing and testing. This solution works on Windows XP, 7 (32bit) and 7 (64bit);

[size=4][font=arial,helvetica,sans-serif]Func _GetDefaultBrowser()
local $browserTest1 = RegRead("HKEY_CURRENT_USERSoftwareClientsStartMenuInternet","")
local $browserTest2 = RegRead("HKEY_CLASSES_ROOThttpshellopencommand","")[/font][/size]
[size=4][font=arial,helvetica,sans-serif] if not $browserTest1 = "" Then
$browser = $browserTest1
Else
$browser = $browserTest2
endif[/font][/size]
[size=4][font=arial,helvetica,sans-serif] Select
case StringInStr($browser,"IExplore")
return "Internet Explorer V" & RegRead("HKEY_LOCAL_MACHINESoftwareMicrosoftInternet Explorer","version")
case StringInStr($browser,"Chrome")
return "Chrome V" & RegRead("HKEY_CURRENT_USERSoftwareGoogleUpdate","version")
case StringInStr($browser,"Firefox")
return "Firefox V" & RegRead("HKEY_LOCAL_MACHINESoftwareMozillaMozilla Firefox","CurrentVersion")
case StringInStr($browser,"Opera")
return "Opera V" & FileGetVersion (RegRead("HKEY_CURRENT_USERSoftwareOpera Software","Last CommandLine v2"))
case StringInStr($browser,"Safari")
return "Safari V" & RegRead("HKEY_LOCAL_MACHINESoftwareApple Computer, Inc.Safari","version")
case Else
return "Unsupported (" & $Browser & ")"
EndSelect
EndFunc[/font][/size]
[size=4][font=arial,helvetica,sans-serif]

(This is my first post so apologies if the code post doesnt come out as planned!)

Edited by sticks221
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...