mikolaskova Posted January 2, 2020 Share Posted January 2, 2020 Hello, I want to work with the image data of a jpeg-image like in this example: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_canvas_getimagedata2 On a webserver it works fine, but if I test locally I get an error Quote index.html:16 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. Isn't it possible to work locally? How do I have to change the script in order to run it locally? I will work with my (young) students with javascript and would like to work locally. Best Regards Link to comment Share on other sites More sharing options...
Ingolme Posted January 2, 2020 Share Posted January 2, 2020 Browsers have security in place to prevent local scripts from mining information from the user's computer. Aside from that, if the image you are loading is not on your computer then the cross-origin protection will apply. I would suggest installing server software, such as XAMPP, on your computer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now