Custom ActiveX Event for IE 11

Dec 17, 2013
Microsoft’s IE 11 has been released for a while now. The new version of Internet Explorer, which has been redesigned with many new features, is excellent on performance. However, it removes some old features that may cause compatibility problems for ActiveX based web application, such as the document scanning online demo for Dynamic Web TWAIN. This demo is designed to scan document pages from an automatic document feeder, and upload them through FTP or a web server. Because IE 11 has removed support for the attachEvent method, some custom events based on this method have to be changed. In the online_demo_scan.aspx, add one line at the bottom of the source. [xml] // add this line </body> </html>[/xml] Then open dynamsoft.webtwain.initiate.js, create a conversion function, and add some code for IE 11. [javascript]Function.prototype.getName = function() { return   this.toString().match(/function\s([^(])(/)[1] }[/javascript] [javascript]SWebTwain.prototype._createControl = function() { var varDWTContainer; var objString = “<div id ='" + this._strDWTInnerContainerID + "' style='position: relative;width:" + this._iWidth + "px; height:" + this._iHeight + "px;'>”; // For IE, render the ActiveX Object if (Dynamsoft.Env._bInIE) { objString += “”; ua = (navigator.userAgent.toLowerCase()); // Event for IE 11 if (ua.indexOf(‘trident’) != -1 && ua.indexOf(‘msie’) == -1) { if (this._onPostTransfer != ‘’) objString += “”;[/javascript] With a little bit of change, the demo for controlling a scanner can now work in IE 11.

Subscribe Newsletter

Subscribe to our mailing list to get the monthly update.