I’m trying to use local images on a web page in FireFox. The problem is whatever I do, I see a security message and images won’t load:
Security Error: Content at http://domain.com/ may not load or link to file:///E:/path/to/file/file.png.
I put the following content into user.js and copied that file in FireFox profile directory.
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", 'http://domain.com');
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
What I want to do is add css file and use that for styling the page.
Edit:
I wrote an extension which alters HTTP response and replace remote css files with local ones. But as I said , Firefox prevent local css files from loading.
Edit 2
Please do NOT remove firefox-addon tag from this question.
Don’t do this – access to the
file://protocol has been locked down for a reason. If your goal is to replace images with local data then just don’t use thefile://protocol, there are plenty of others available. You can use thedata:protocol for example. This is the SO icon as adata:URL:This URL is easily generated:
Alternatively you could use
resource://URLs that can be mapped to directories on disk usingnsIResProtocolHandlerbut that’s more complicated. Keep in mind that all contents of the mapped directory become accessible to all websites. You should make sure that it doesn’t contain any sensitive information.Asker:*
I added content of the link: