在Windows上本地运行时,canvas getImageData不起作用? (安全异常) [英] canvas getImageData doesn't work when running locally on Windows? (security exception)

查看:670
本文介绍了在Windows上本地运行时,canvas getImageData不起作用? (安全异常)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个本地HTML5应用程序来处理一些科学图片。我在OS X上,我专门用JavaScript / HTML5编写它的可移植性,以便我可以在Windows机器上向我的主管演示。这个应用程序永远不会部署在服务器上。

I'm writing a local HTML5 app to process some scientific images. I'm on OS X, and I'm specifically writing it in JavaScript/HTML5 for portability so that I can demonstrate it to my supervisor on a Windows machine. This app will never be deployed on a server.

问题是,它在OS X上的Safari上工作得很好,但在Windows上,它在Firefox中引发了一个安全错误和Chrome。我认为这是因为认为图片位于不同的网域,但实际上它与脚本位于同一个文件夹中。

The problem is, it works perfectly on Safari on OS X, but on Windows it throws up a security error both in Firefox and Chrome. I think this is because it thinks the image is on a different domain, but in reality it's in the same folder as the script.

有问题的错误与这里详述的一样:

The error in question is the same as detailed here:

http://stackoverflow.com/questions/2704929/uncaught-error-security- err-dom-exception-18

编辑:我应该澄清一下,我链接的问题的答案(在本地服务器上运行)可行,因为我不能去在这些机器上安装任何软件(或服务器!)。

I should clarify, the answer on the question I linked (running it on a local server) isn't feasible because I can't go and install any software (or servers!) on these machines. The reason I'm hoping for an alternative answer is because it does work on OS X.

推荐答案

的原因,我希望另一个答案是因为 >要在Chrome中绕过跨源发行,您可以使用此标志运行Chrome:

To get around cross-origin issies in Chrome you can run Chrome with this flag:

--allow-file-access-from-files

这篇关于在Windows上本地运行时,canvas getImageData不起作用? (安全异常)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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