Not able to get data url when using images in kinetic js

孤街醉人 提交于 2019-12-13 04:54:58

问题


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.


回答1:


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/:

"The toDataURL() method requires that any images drawn onto the canvas are hosted on a web server with the same domain as the code executing it. If this condition is not met, a SECURITY_ERR exception is thrown"



来源:https://stackoverflow.com/questions/16684784/not-able-to-get-data-url-when-using-images-in-kinetic-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!