Search code examples
javascriptinternet-explorerinternet-explorer-10activexobject

IE10: how to branch JS for ActiveX without conditional comments?


My organization has a tech form that captures browser version info about SWF, PDF, MP4, etc.

Up to now, branching for Explorer vs everyone else was simple: a script loaded from a conditional comment runs ActiveX tests, while other browsers check navigator.plugins[] and navigator.mimeTypes[].

Unfortunately, IE10 ignores conditional comments, but it doesn't support the navigator arrays either. Do I need to put all the ActiveX stuff in the main script? And if so, what is the if() statement to control it?


Solution

  • As the commenters said, testing for window.ActiveXObject returns true on IE 10 and below. But note that Microsoft is abandoning ActiveX in their new Microsoft Edge (formerly Project Spartan) browser.