I'm creating a dynamic anchor element using javascript it's working in Chrome and Firefox but in IE (all version till 11), a.click() says "Access is Denied" below is my code:
var url = "https://www.test.com/test.mp4";
var request = new XMLHttpRequest();
request.open("GET", url, true);
request.responseType = "blob";
request.onload = function (e) {
if (this.status === 200) {
var file = URL.createObjectURL(this.response);
var a = document.createElement("a");
a.href = file;
a.download = (this.response.name || "file-" + new Date().getTime()) + ".mp4";
a.id = "downloadVideo";
document.body.appendChild(a);
a.click();
window.addEventListener("focus", refocus, false);
}
};
request.send();