IntelliJ JCEF browser does not load CSS images such as url("ul.png")
I am using the JCEF browser as part of the Asciidoc-Editor.
(There is an option to use Swing instead but the results which jbcef are much better.)
Within some file.adoc I set the following attribute:
:stylesheet: style.css
And within the style.css I use some image, e. g.:
ul {
padding-left: 0.36cm;
list-style: square outside url("ul.png");
}
When I generate the HTML it looks fine.
Within the preview, I got sqares instead of the given image. The type of image file does not matter, besides PNG i've also tried GIF or SVG. The developer tools report a file not found error for the image file.
If I change the url to a global path on the local file system, it works fine.
I also tried to place some SVG directly into the url, as described here: https://css-tricks.com/lodge/svg/09-svg-data-uris/. The developer tools report a security error for the image file because chromium does only accept data from the local file system due to security settings.
Please sign in to leave a comment.
Sasha,
With no details regarding your setup, I'd assume that ul.png as it can't be correctly resolved if it's not explicitly provided next to the requested page.
Providing images inline as a base64 encoded content would be the safest way to handle it.
Jakub,
I've tried your solution and get the same error as with the embedded SVG:
Refused to load the image 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAALCAYAAAC3ZUeVAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAYSURBVBhXY3zDIPafAQ0wQWkUMIQFGRgA1KACF4IGl+kAAAAASUVORK5CYII=' because it violates the following Content Security Policy directive: "img-src file: localfile: *".
Sascha, sorry for the late reply – this thread got lost in a queue. Did you manage to handle it?
This problem still exists.