搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

How can I allow local images to be read on canvas since FF60?

more options

I am a developer and I want to test canvas and JavaScript locally. Previously I have been able to interact with the canvas when the canvas accesses local graphics. Now I get this error: uncaught exception: An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images. Not sure which version this changed - I think 60.

This has always been the case in Chrome and for Chrome we use a --allow-file-access-from-files flag when starting the Chrome app. Is there a about:config setting to allow use to continue to develop and teach workshops, etc. locally without having to go through hoops?

If there is currently no way - can you please add a way. Firefox is my default browser - would love to keep it that way!

Thanks!

I am a developer and I want to test canvas and JavaScript locally. Previously I have been able to interact with the canvas when the canvas accesses local graphics. Now I get this error: uncaught exception: An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images. Not sure which version this changed - I think 60. This has always been the case in Chrome and for Chrome we use a --allow-file-access-from-files flag when starting the Chrome app. Is there a about:config setting to allow use to continue to develop and teach workshops, etc. locally without having to go through hoops? If there is currently no way - can you please add a way. Firefox is my default browser - would love to keep it that way! Thanks!

被采纳的解决方案

Hey - just found out that what I thought was a change perhaps is not a change. The file I was using had a URL to ../somedirectory/image.png and that is causing the canvas security error. When I move the image.png into the same directory or an assets/ directory inside the same directory, there is no error. So it is possible, that I have not tried to access local files going backwards in directory structure on Firefox. So... I am not so worried about it anymore and I guess can call the issue solved. Thanks for your advice.

定位到答案原位置 👍 0

所有回复 (6)

more options

Sorry no idea, someone else will though.

May want to think about using the Developer Edition. https://www.mozilla.org/en-US/firefox/developer/ You can run it as well is Standard Firefox as there is compatibility mode at the end of the install. If you do it shares your bookmarks and more so do this.

more options

Did you check "Tools -> Page Info -> Permissions" to see if there is a checkbox for accessing Canvas (Extract Canvas Data)?

more options

Thanks Pkshadow and cor-el for the responses. I suspect that the change is new and perhaps Firefox does not have a way to turn off the canvas security on local images. This has not been a problem in earlier Firefox versions. Personally, I would expect it to show up in the about:config as a boolean we could turn off. As far as I know there is no "Tools -> Page Info -> Permissions" anymore and there is no longer an about:permissions. In the permissions in Options > Privacy, etc. there are no canvas settings I can see. So... still looking for an answer. Thanks!

由inventordanzen于修改

more options

There should still be "Tools -> Page Info -> Permissions" and yes about:permissions is gone for a long time.

It looks that "Resist Fingerprinting" needs to be enabled to see this canvas setting in Page Info.

more options

Hi cor-el, can you please advise on how I find the "Tools -> Page Info -> Permissions" - I have searched and web searched and cannot find it on my Win 10 FF60. That aside, I don't think resist fingerprints is helping or perhaps even related. I am creating a web page where I load an image (png/jpg) into a Canvas Bitmap and the page has interactivity. I want to test locally before it goes on a server. This used to be allowed when viewing the html page locally in Firefox. Now it is giving the same security error that Chrome has given for years. In Chrome we overcome this security check by setting --allow-file-access-from-files on the exe when starting Chrome. I would assume or hope that now that Firefox is giving this error that there would be some way to change my browser so I can continue to test locally - or teach students and run locally - without getting this error. An about:config setting would make sense for instance.

more options

选择的解决方案

Hey - just found out that what I thought was a change perhaps is not a change. The file I was using had a URL to ../somedirectory/image.png and that is causing the canvas security error. When I move the image.png into the same directory or an assets/ directory inside the same directory, there is no error. So it is possible, that I have not tried to access local files going backwards in directory structure on Firefox. So... I am not so worried about it anymore and I guess can call the issue solved. Thanks for your advice.