Hi,
I am using a WebEngineView to show messages (like a chat), with the help of a WebChannel.
I set a html from resources as url of the WebEngineView:
WebEngineView {
id: myChat
...
url: "qrc:/res/test.html"
...
}
WebEngineView {
id: myChat
...
url: "qrc:/res/test.html"
...
}
To copy to clipboard, switch view to plain text mode
To display an image in my html, i add a 'div', for instance:
<div class="file-thumbnail" style="background-image: url(file:///C:/Users/Diego/AppData/Local/Temp/Penguins.png);"></div>
<div class="file-thumbnail" style="background-image: url(file:///C:/Users/Diego/AppData/Local/Temp/Penguins.png);"></div>
To copy to clipboard, switch view to plain text mode
The thumb is displayed properly, since the file is available in this path
In one moment, i save all the html content into a string and restore it after a while using
myChat.loadHtml(text);
myChat.loadHtml(text);
To copy to clipboard, switch view to plain text mode
The html content is displayed properly except for the image, an error message appears in console:
js: Not allowed to load local resource: file:///C:/Users/Diego/AppData/Local/Temp/Penguins.png
js: Not allowed to load local resource: file:///C:/Users/Diego/AppData/Local/Temp/Penguins.png
To copy to clipboard, switch view to plain text mode
The image is still there, if I set this link in a real Chrome browser the image is open properly
Any idea? Thanks a lot in advance,
Diego
Bookmarks