'Execution stop after dispatchevents called
In the below code I have exported the canvas image and need to set that image in the web page. However the execution stops once it is exported that is execution stops after calling pom.dispatchEvent(e); the following line is not executed.
$("#Digital").attr("src", 'C:\Users\labuser\Downloads' + img + '.PNG');
Please help me...
blob = new Blob([buffer], { type: "image/png" });
var pom = document.createElement('a');
var url = URL.createObjectURL(blob);
pom.href = url;
pom.setAttribute('download', img + '.png');
if (document.createEvent) {
e = document.createEvent("MouseEvents");
e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
pom.dispatchEvent(e);
}
$("#Digital").attr("src", 'C:\Users\labuser\Downloads' + img + '.PNG');
Solution 1:[1]
Assuming that the $ is a Jquery call, it will fail silently if incorrect.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shane Edwards |
