SECURITY_ERR: DOM Exception 18 ONLY IN Safari when using canvas.toDataURL("image/png")

StackOverflow https://stackoverflow.com/questions/23673148

Вопрос

In my app I am trying to convert an image to canvas. What I am doing is this.

I am trying to upload image from an external server and when this thing is done if the height of the image is greater then its width I am drawing it on canvas and rotating it.

It is working great in Chrome and FF but in Safari I am getting this error

SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent.

I am not getting what this is. Can anybody let me know about this?

Это было полезно?

Решение

Try finding the exact line that is breaking. When safari is set Always block cookies and other website data then it breaks local storage, and several of the image manipulation APIs. You might try to determine exactly which line is failing, and wrap that line in a try/catch.

enter image description here

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top