在Dynamic JS中使用图像时无法获取数据URL [英] Not able to get data url when using images in kinetic js

查看:132
本文介绍了在Dynamic JS中使用图像时无法获取数据URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用动力学js使用HTML5画布构建应用程序,用户可以在其中拖放图像,然后保存最终图像.它给出了以下错误: 无法获取数据网址. SecurityError:DOM异常18 请帮忙.

I'm using kinetic js to build an application using HTML5 canvas where users drag and drop images and then save the final image. It is giving the following error: Unable to get data URL. SecurityError: DOM Exception 18 Please help.

推荐答案

当绘制到画布上的图像和代码位于不同的服务器上时,就会发生这种情况.如从 http://www.html5canvastutorials.com/kineticjs/html5引用-canvas-stage-data-url-with-kineticjs/:

It happens when the images drawn onto the canvas and the code are on different server. As quoted from the http://www.html5canvastutorials.com/kineticjs/html5-canvas-stage-data-url-with-kineticjs/:

" toDataURL()方法要求将绘制到画布上的任何图像托管在与执行该代码的域相同的域的Web服务器上.如果不满足此条件,则会引发SECURITY_ERR异常"

这篇关于在Dynamic JS中使用图像时无法获取数据URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆