When I replace the attach event instances that were used to bind to events triggered by the ActiveX with AddEventListener, such events are no longer triggered in IE 11 browser.
However, if I set the compatibility mode (as below) and then use attachevent as before it works fine.
<meta http-equiv="X-UA-Compatible" content="IE=10" />
would like to know whether addeventlistener can be really used? or is there any alternate solution.
I have given below the sample code which was already posted by someone in the internet stating the same problem which I am encountering now.
Here are some html code examples that illustrate the problem.
(I have created a simple activeX based on an MFC activeX control that simply triggers an event inside OnCreate. This event sends 2 strings as parameters. If you need the code or even the ocx file for the activeX, please let me know.
<!DOCTYPE html><html><head><title>TestEvent Example HTML</title><metacharset="utf-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="description"content=""><metaname="viewport"content="width=device-width, initial-scale=1"></head><body><table><tr><td><OBJECTID='testAxEvent'CLASSID='CLSID:BA19A985-C93E-491B-B801-2EB7F903C8CE'codebase="testAxEvent.cab"width='120'height='80'></OBJECT></td></tr><tr><tdheight='30'></td></tr><tr><tdalign=center><fontsize=5><divid='msg'></div></font></tr></table></body><script>function onTestEvent(szType, szValue){var MSG = document.getElementById("msg"); MSG.innerHTML = szType +" : "+ szValue;}var elem = document.getElementById("testAxEvent");// Test 3 - addEventListener// Does not work on IE11 ! elem.addEventListener("testEvent", onTestEvent,true); elem.addEventListener("testEvent", onTestEvent,false);</script></html>