views:

172

answers:

1

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...

+1  A: 

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.

Saul
Hmmm, seems a little heavy-weight to write an ActiveX control to figure this out. I had considered doing this before but it seemed like too much work, however, based on the reference you cited it looks like that's the only possible solution.As far as letting them stay with QuickTime I would never override their settings because like you say, it's their machine to do with as they want. My intent is to simply notify them that they will likely have problems viewing the Tiff images served by my application because the QuickTime Viewer doesn't support the entire Tiff standard.Thanks Saul...
Jay13