简体   繁体   中英

Canvas create an image from URL

I have a url that generates images on canvas with parameters. I works ok when I load with browser.

The last line is:

 window.location = canvas.toDataURL("image/png");

When I try to use this url from another page like:

<img src="http://localhost/index.html?i=0 />

Doesnt load. How can i load it.

Thanks in advance.

It's a security issue. You can't read image data in canvas if the image is not on the same domain. There aren't any work-arounds, sorry

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM