Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
145
rated 0 times [  147] [ 2]  / answers: 1 / hits: 73688  / 15 Years ago, fri, march 5, 2010, 12:00:00

Did I not get enough sleep or what? This following code



var frame=document.getElementById(viewer);
frame.width=100;
frame.height=100;

var ctx=frame.getContext(2d);
var img=new Image();
img.src=http://www.ansearch.com/images/interface/item/small/image.png

img.onload=function() {
// draw image
ctx.drawImage(img, 0, 0)

// Here's where the error happens:
window.open(frame.toDataURL(image/png));
}


is throwing this error:



SECURITY_ERR: DOM Exception 18


There's no way this shouldn't work! Can anyone explain this, please?


More From » html

 Answers
21

In the specs it says:




Whenever the toDataURL() method of a
canvas element whose origin-clean flag
is set to false is called, the method
must raise a SECURITY_ERR exception.




If the image is coming from another server I don't think you can use toDataURL()


[#97409] Wednesday, March 3, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mackennamelissac

Total Points: 110
Total Questions: 118
Total Answers: 103

Location: Sweden
Member since Sun, Jan 16, 2022
2 Years ago
;