Fix mouse click error on IE11
MouseEvent initialization was failing on IE11.
Add a separate case for IE11 that fixes the issue.
@@ -96,11 +96,30 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f
linkElement.setAttribute('href', url);
linkElement.setAttribute("download", filename);
- var clickEvent = new MouseEvent("click", {
+ var clickEvent;
+
+ if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) { // for IE 11
+ clickEvent = document.createEvent("MouseEvent");
+
+ clickEvent.initMouseEvent("click", /* eventName */
+ true, /* bubbles */
+ false, /* cancelable */
+ window, /* view */
+ 0,0,0,0,0, /* detail, screenX, screenY, clientX, clientY */
+ false, /* ctrlKey */
+ false, /* altKey */
+ false, /* shiftKey */
+ false, /* metaKey */
+ 0, /* button */
+ null /* relatedTarget */
+ );
+ } else {
+ clickEvent = new MouseEvent("click", {
"view": window,
"bubbles": true,
"cancelable": false
});
+ }
linkElement.dispatchEvent(clickEvent);
} catch (ex) {
caught = ex;
