Canvas.toDataURL()引发安全异常 [英] Canvas.toDataURL() throws security exception

查看:109
本文介绍了Canvas.toDataURL()引发安全异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!
我有一个HTML页面,上面有一个画布.我正在尝试将画布转换为图像.实际上,当它在本地IIS服务器上时,它可以工作.
但是,当我将其作为独立的hmtl文件运行时,它不起作用.当我在谷歌浏览器上调试它时,出现以下异常.

行:

Hi!
I''ve a html page that has a canvas on it. I''m trying to convert canvas to image. Actually it works when its on local IIS server.
However , it doesnt work when i run it as a independent hmtl file. When i debugged it on google chrome i get following exception.

Line:

var strData = oScaledCanvas.toDataURL("image/png")


异常:未捕获的错误:SECURITY_ERR:DOM异常18

我想画布有一些安全限制.
我的问题是,如何避免这种异常?
或如何将本地html文件上的画布转换为图像?


Exception : Uncaught Error: SECURITY_ERR: DOM Exception 18

I guess, canvas has some security restrictions.
My question is , how can avoid this exception ?
Or how can i convert canvas on local html file to image ?

推荐答案

检查这些

解决WebGL跨域图像加载错误SECURITY_ERR:DOM异常18 [ ^ ]
未捕获的错误:SECURITY_ERR:DOM异常18 [
Check these

Resolving WebGL cross domain image loading error SECURITY_ERR: DOM Exception 18[^]
Uncaught Error: SECURITY_ERR: DOM Exception 18[^]


这篇关于Canvas.toDataURL()引发安全异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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