简体   繁体   English

画布从URL创建图像

[英]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 没有任何解决方法,对不起

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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