Is it possible to display local image in current document without violating the security constraints.
Example: image is in chrome://myExtension/content/2.png
$myImg=jQuery("#myImg", doc);
$myImg.attr("src","chrome://beSure/content/2.png");
Error Console: Security Error: Content at https://www.google.com/accounts/ServiceLogin?….&from=login may not load or link to chrome://myExtension/content/2.png.
Working example with non-local link:
$myImg=jQuery("#myImg", doc);
myImg.attr("src","http://cdn1.iconfinder.com/data/icons/classic-cars-by-cemagraphics/128/minicar_128.png");
Image comes from valid url so that is ok. But how can i display local image ?
Your chrome package needs to be declared with the
contentAccessibleflag in thechrome.manifest, see documentation. By default, web pages are no longer allowed to load images fromchrome://, this previously allowed web pages to detect installed extensions by loading their images.The other possibility should be using
image.srcproperty instead of setting the attribute:This should work because here your (privileged) script is setting image location directly. Attribute changes on the other hand are processed asynchronously, so this is done with the privileges of the web page.