Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE browser script to determine which (if any) ActiveX control will handle specific mime type

I'm trying to figure out in an IE script (javascript or vbscript) which ActiveX control will handle a specific mime type, "image/tiff" in this case. This is easy to do in other browsers that use plugins with;

navigator.mimeTypes["image/tiff"].enabledPlugin.name

which would return something like

QuickTime Plug-in X.X.X

I've found plenty of examples to tell if a specific ActiveX control is loaded but since there are several ActiveX controls available that can handle tiff images I need to know which, if any, is registered to handle this mime type.

The problem I'm trying to deal with is that QuickTime always wants to register itself as the default tiff viewer but it does a terrible job of it resulting in lots of support calls. Unfortunately, simply detecting that QuickTime is installed isn't good enough since the user may also have another tiff viewer installed (like Alternatiff) as the default tiff viewer or the user may have configured QuickTime to not be the default viewer for tiff images so the browser could be using a helper app to display the image instead.

Not meaning to be difficult but before anyone suggests reengineering workarounds;

  • yes I know I could force the user to use a specific ActiveX viewer in IE or to use a Java tiff viewer but I'd rather let them use a viewer of their choice rather than forcing them to install a viewer of my choosing, especially since their viewer may be a helper app that loads the tiff image into a business workflow within their office
  • yes I know there are other image formats that I could use but tiff is the defacto standard for document imaging and that's what the vast majority of these users prefer to use. The problem isn't the image format, it's that QuickTime just doesn't cut it as a tiff viewer

Thanks in advance for any suggestions or solutions...

like image 822
Jay13 Avatar asked May 16 '10 02:05

Jay13


People also ask

Is ActiveX obsolete?

ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide Web.

Does ie11 support ActiveX?

The Internet Explorer 11 desktop application is retired and out of support as of June 15, 2022 for certain versions of Windows 10. You can still access older, legacy sites that require Internet Explorer with Internet Explorer mode in Microsoft Edge.


1 Answers

At least with current capabilities of Internet Explorer, it is pretty much impossible to accomplish your stated goal with Javascript.

However, IE also supports VBScript and signed ActiveX controls. You could use those to build a client-side widget to get the default MIME-type association directly from the registry. Windows keeps them in "HKEY_LOCAL_MACHINE\Software\CLASSES\". The RFC2936 - HTTP MIME Type Handler Detection gives a similar suggestion and even has a code sample.

If the above seems too cumbersome, then you could expand on your initial policy of not restricting the user to a specific viewer. Why not go all the way and let users stay with QuickTime if they have it in the first place. The user's machine is private territory and you have no way of knowing why QuickTime is there.

Hope this helps to get you moving in the right direction.

like image 156
Saul Avatar answered Sep 18 '22 11:09

Saul