Search code examples
javascripthtmlvisual-studio-2008qt4qtwebkit

Qt Webkit : Not allowed to load local resource


Greeting

When i try to load picture from local drive i get the following error !!!

Not allowed to load local resource: file:///c:/qt/4.8.5/examples/webkit/imageanalyzer/resources/images/mtRainier.jpg

This is how i try to load image in HTML.

<img id="ImageObject" src="file:///c:/qt/4.8.5/examples/webkit/imageanalyzer/resources/images/mtRainier.jpg" alt="" width="304" height="228">

How can i fix this ?

Im using QT 4.8.5 , Qt Webkit And Visual Studio 2008.

Thanks in Advance


Solution

  • I found the problem !!! JPEG was not supported in my qt. The error is totally irrelevant. Add JPEG support to your project and you're good!

    PS: If you have same problem and you want to know this solution will help you or not, Try following code and see supported formats, If JPEG is not among them, Then you have same problem otherwise this solution wont work for you!

    qDebug() << QImageWriter::supportedImageFormats();