0

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" ... }

To display an image in my html, i add a 'div', for instance:

<div class="file-thumbnail" style="background-image: url(file:///C:/Users/LocalUser/Diego/Local/Temp/Penguins.p‌​ng);"></div>

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);

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

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

Diego
  • 336
  • 2
  • 21

1 Answers1

0

I found it. It seems to be a problem with the WebEngineView class and web security.

I had to add an argument to my QApplication a new argument: "--disable-web-security"

Now it works.

Diego

Diego
  • 336
  • 2
  • 21