[Qt-interest] Qt 4.5.0 WebKit not loading resources that were loaded by 4.4.3

Rush Manbert rush at manbert.com
Thu Mar 19 22:41:55 CET 2009


On Mar 19, 2009, at 1:00 PM, Pascal Patry wrote:

> On March 19, 2009 02:28:10 pm Rush Manbert wrote:
>> [...]
>> The biggest difference that I see between Qt 4.4.3 and 4.5.0 is that
>> my app built against 4.4.3 loads all of the external resources and
>> behaves as I expect. When I build it against 4.5.0 it loads none of
>> the external resources. The HTML is being read and interpreted,
>> because it contains a <button> element that shows up, but everything
>> else is missing.
>> [...]
>
> I don't know if you are seeing the same issue as I saw, but if you  
> are loading the page
> from the disk, you now need to put the protocol, not only the path.
>
> For instance, this:
>
>    QString path = "<local path to a file>";
>    QWebView view;
>
>    view.load(path);              // usage #1
>    view.load("file:///" + path); // usage #2
>
> The usage #1 didn't load any external reference. No image.. nothing.  
> By adding the
> protocol in front of the url, it then loaded everything.
>
> Like I said, it might not be the same issue as what you are seeing,  
> but it's something you
> may want to have a look.

Excellent call, Pascal. What I actually load is from a string, but I  
need to call setUrl() once to kick the whole thing off. Then I can  
intercept at QNetworkAccessManager::createRequest() and return my real  
content. For historical reasons, we were using http://op.dummyDomainName/ 
  as the URL. But it seems that if I don't use something of the form file://localhost/opCode 
, then local resources (which are specified in the web page by using  
the full URL, including protocol as file:://localhost/ and full path)  
don't get loaded. That makes sense from a security point of view. You  
don't expect http:-sourced web pages to be loading local resources.

Anyway, I changed my initial URL to use the file: protocol and now 4.5  
works just like 4.4.3. (Which still seems to have a problem, but that  
is a subject of a different post.)

Thank you again for the help.

Best regards,
Rush



More information about the Qt-interest-old mailing list