In Greasemonkey, I am trying to use a local copy of an image found on the Internet. The image is temporarily stored in the C: \ temp folder.
This does not work:
var b = document.body;
b.style.background = '#ccc url("file:///C:/temp/bg.jpg") repeat-x top left';
In Firebug, I can hover over a path in the style window, and the image will pop up, showing that the image is there and that the path is correct, but Firefox just doesn't display it. I even tried redrawing the page:
setTimeout(function(){element.className = element.className;},500);
If I use the path to the original http URL (http: //somedomain/bg.jpg), it will work, but tries to avoid it. I'm not sure why he has problems rendering local images.
source
share