Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect which version of Internet Explorer is installed?

Is the best way to look under the Uninstall key of the Windows Registry? Is there a Microsoft API call which provides this info and is it supported from XP onwards?

What is the best way to detect which version of Internet Explorer is installed on the local machine?

like image 983
Maltrap Avatar asked Aug 24 '10 06:08

Maltrap


2 Answers

I'd like to challenge the conventional wisdom of inspecting the registry. Consider the reference source for System.Windows.Forms.WebView.Version:

string mshtmlPath = 
   Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "mshtml.dll");
FileVersionInfofvi = FileVersionInfo.GetVersionInfo(mshtmlPath);
return new Version(
             fvi.FileMajorPart, fvi.FileMinorPart, fvi.FileBuildPart, fvi.FilePrivatePart);

Presumably, the guys who wrote the WebView class knew what they were doing.

like image 113
Ohad Schneider Avatar answered Oct 07 '22 12:10

Ohad Schneider


You have to look in the registry, but not in uninstall key. Instead, find the key at HKLM\Software\Microsoft\Internet Explorer and read the value named Version.

For newer versions (IE 10 and above), Version is 9.x (for example, IE 10 is 9.10.something), and the new svcVersion value gives the true IE version.

This technique is even recommended by Microsoft; see here.

like image 22
Andrea Parodi Avatar answered Oct 07 '22 12:10

Andrea Parodi