Check if WebBrowser is installed

All tutorials created in C# to be posted in here.
1 post Page 1 of 1
Contributors
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Check if WebBrowser is installed
XTechVB
A few days ago i ran into a problem, I needed to know which WebBrowsers are installed, this can be difficult because not everyone installs them in the same directory. But after a bit of research i came up with this code
Code: Select all
        private bool BrowserInstalled(string browserName)
        {
            //-- Browser Existance
            bool _IsInstalled = false;
            //-- Get installed browsers
            RegistryKey _BrowsersNode = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Clients\StartMenuInternet");
            //-- Search all browsers
            foreach (string _Browser in _BrowsersNode.GetSubKeyNames())
            {
                if (_Browser.ToLower().Contains(browserName.ToLower()))
                {
                    _IsInstalled = true;
                    break;
                }
            }
            //-- Return browser existace
            return _IsInstalled;
        }
Apparently Windows has a list of the installed WebBrowsers in the Registry, so after i found that the rest was piece of cake.
This method checks all the names in that list until it finds one that contains the name of the WebBrowser you want to see if is installed. Like this for example
Code: Select all
            if (BrowserInstalled("firefox")) //-- firefox, iexplore, chrome, opera, etc...
            {
                MessageBox.Show("Mozilla Firefox is installed");
            }
I only tried this on Windows 7, but i believe it will work on others too.
You can find me on Facebook or on Skype mihai_92b
1 post Page 1 of 1
Return to “C-Sharp Tutorials”