Source language: Translate to:

Help. Problem with canvas.

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Help. Problem with canvas.

Postby anton » Sun Jan 17, 2016 1:15 am

I am trying to open an image from the canvas as follows:
Code: Select all
var canvas = document.getElementById("test-canvas");
window.open(canvas.toDataURL("image/png"),"tfract_save");

In the console, I get the following error:
Code: Select all
SecurityError


If anyone know what is wrong ?
User avatar
anton
 
Posts: 53
Joined: Fri Oct 19, 2012 9:21 pm

Re: Help. Problem with canvas.

Postby Tony Kroos » Sun Jan 17, 2016 4:36 am

Looks like it's a "cross-origin" security error.
Although you can use images without CORS approval in your canvas, doing so taints the canvas. Once a canvas has been tainted, you can no longer pull data back out of the canvas. For example, you can no longer use the canvas toBlob(), toDataURL(), or getImageData() methods; doing so will throw a security error.

This protects users from having private data exposed by using images to pull information from remote web sites without permission.

Read more here.
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Re: Help. Problem with canvas.

Postby anton » Sun Jan 17, 2016 10:23 am

Tony Kroos wrote:Looks like it's a "cross-origin" security error.
Although you can use images without CORS approval in your canvas, doing so taints the canvas. Once a canvas has been tainted, you can no longer pull data back out of the canvas. For example, you can no longer use the canvas toBlob(), toDataURL(), or getImageData() methods; doing so will throw a security error.

This protects users from having private data exposed by using images to pull information from remote web sites without permission.

Read more here.

Ok... Thank you so much.
User avatar
anton
 
Posts: 53
Joined: Fri Oct 19, 2012 9:21 pm


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron