简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM