QWebView doesn't load files in Windows
I am developing under Linux a program, which uses QWebView And QWebPage.
I have some index.html files located in a folder on my PC and the index files are loading images and css files in the same directory.
In Ubuntu Linux, this works fine. When I load the index.html file, the css and imagefiles located in the same directory are also loaded.
In Windows, this doesn't work really. It's not opening any file and so, nothing works.
What can I do, that Windows is also loading the files located in the same directory?
I am using the same code, no changes, nothing, but it doesn't work
I have any file, let me say in C:\HTMLdata:
I now want to load the index file, which load the other to files with "./image.png" and "./style.png".
In Linux, it works without any problems. In Windows, it doen't work. But why?
I expect this related to Windows path issue, because Windows doens't accept "/" while it works with "" so try to use this QDir static function to clean up the paths:
Unfortunately, it doesn't help :(
I also cannot parse all html files. I think, that cannot be also the problem, because all URLs in the web uses "/", like also this page. Then, I wouldn't open this page also :(
why do you use "./"? HTML doesn't need it. simply include "image.png" and it will try to load it from current folder.
"./" path exist only in UNIX like systems, but not in windows....
It also don't work with "image.png". I tested it. That was also one of my first idea.
I think, it's a bug in Qt. It also doesn't work with QtWeb, but my HTML file works fine in Firefox, Opera, IE etc.
I think, I have to parse all HTML file and make all strings started with "./" to a absolute path. Then it works also in Windows...
One more idea: what is your current working directory? try to set it to the path where your files are...