Results 1 to 17 of 17

Thread: QWebview fails to load page css on windows xp

  1. #1
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QWebview fails to load page css on windows xp

    Hi.
    I am currently trying to create a twitter sharing window in my application.
    So I use the twitter api to get an url with an authentication token from twitter and load it in my QWebview.

    The url looks like this: https://api.twitter.com/oauth/author...kWiFkc&lang=fr

    There is no problem at all in windows 7, but in windows XP, the webview does not seem to load the web page's css...

    So the result is very ugly (see attached images...)

    Any idea to make this work ? Or any hint on why this does not work ?
    Attached Images Attached Images

  2. #2
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    bump.......

  3. #3
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    Still no one ?
    Any idea ?

  4. #4
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWebview fails to load page css on windows xp

    Never had problems running css through a QWebview on Windows XP after compiling it on a windows 7 platform. I've look through some older programs and the one I am certain ran fine on windows xp didn't have the below code for enabling plugins. Flash embeds are nice with QWebview. But maybe adding this would help? I do believe the the JavaEnabled setting is currently still not supported, but I keep it with this block in the hope that it will be.

    Your problem might be how you are running the application on the XP computer. Is Qt installed on both machines, or just the Windows 7? If it isn't on the XP computer, and you have all the seemingly required .dll files, you might not have the imageformat/ directory with the .dll's for images... (qgif4.dll, qjpeg4.dll, ...... ) they are not considered crucial to running the program, but no pictures will work in a QWebView, QGraphicsView, or what not.... they are located in your Qt program installation in the bin folder, then in the imageformats folder. And the folder has to be in the directory you are running the application from.

    Qt Code:
    1. QWebSettings *defaultSettings = QWebSettings::globalSettings();
    2. defaultSettings->setAttribute(QWebSettings::JavaEnabled, true);
    3. defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, true);
    4. defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true);
    To copy to clipboard, switch view to plain text mode 

    Hope this helps

  5. #5
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    I did some more testing.
    If I use a facebook login page on the same computer and in the same way, it loads without any problem, with all the graphics.

    I also wiresharked what is exactly going on the network. It seems that the QWebview does not try to get any external ressources for this page (don't download images, css files, etc). It seems to only get the html content of the page and voila... tries to load it.

    I seriously don't understand what is going on with this page...

  6. #6
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWebview fails to load page css on windows xp

    do you have the QtWebKit4.dll and QtXmlPatterns.dll? if it's not getting the external resources maybe that is the problem. Or when you created the project did you put the webkit in?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebview fails to load page css on windows xp

    Quote Originally Posted by marwyn View Post
    I did some more testing.
    If I use a facebook login page on the same computer and in the same way, it loads without any problem, with all the graphics.

    I also wiresharked what is exactly going on the network. It seems that the QWebview does not try to get any external ressources for this page (don't download images, css files, etc). It seems to only get the html content of the page and voila... tries to load it.

    I seriously don't understand what is going on with this page...
    Is the response sent by the server identical in both cases -- when it works and when it doesn't?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    When trying to load the twitter login page in the webview on windows seven, I see a lot of connections going through the network, reaching the page's ressources.
    When i do the same thing on windows XP, i get only a few tcp connections, typically retrieving the page content without anything else...

    One more test : when loading the Facebook login page in teh webView on windows XP, the network traffic is OK : loading images, css, etc

    It seems there is no request sent at all when it fails... It just does not try to get the ressources...

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebview fails to load page css on windows xp

    I'm asking whether the response from the server that contains the main webpage is identical, forget the resources for now.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    The response from the server containing the main page looks similar. SLL handshake, blabla, several client / server HELLOs, getting the main page data. It's encrypted so i can't say if the content it gets is actually the same in both cases.

    Then it gets the IP address of si0.twimg.com (containing the images, css etc according to the source code of the page). handshakes, blabla, HELLOs... And then, it gets data from this server for the one working, and not for the other.

    That's as far as I got for now...

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebview fails to load page css on windows xp

    Similar and identical are two different things. I'm asking whether it is byte-by-byte equal. Without knowing that you can only guess what is wrong.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #12
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    it is not byte to byte equal.
    But as it is encrypted, i don't think this is really relevant... a different salt on the same content will produce different encrypted data...

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebview fails to load page css on windows xp

    Quote Originally Posted by marwyn View Post
    it is not byte to byte equal.
    But as it is encrypted, i don't think this is really relevant... a different salt on the same content will produce different encrypted data...
    I mean the decrypted data, obviously.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #14
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    I obviously can't access it...
    I can't sniff it, i can't BP in it because i'm not in debug mode, and I can't put logs into QWebview to see what is going on...

    Have to guess what is wrong I'm afraid

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebview fails to load page css on windows xp

    Why can't you access it? Decrypt it before it reacher the browser, I'm sure there are proxies available that do this kind of man-in-the-middle attack. Besides, you have access to QWebView's network access manager, and you'll have the data already decrypted there.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. The following user says thank you to wysota for this useful post:

    marwyn (26th August 2011)

  17. #16
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    Trying to access data from the QNetworkAccessManager. I'll keep you informed when I have results

  18. #17
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebview fails to load page css on windows xp

    OK PROBLEM SOLVED !

    This was a problem of ssl connection.
    My guess : facebook gets its ressources from an address in facebook.com domain where twitter gets it from twimg.com domain. And there must be some problems in certificates specific to windows XP with this domain (authority not trusted i think).

    Workaround:

    Qt Code:
    1. void
    2. MyQWebview::load( const QUrl & url )
    3. {
    4. connect( this->page()->networkAccessManager(), SIGNAL( sslErrors( QNetworkReply*, const QList<QSslError> & ) ), this, SLOT( sslErrorHandler( QNetworkReply*, const QList<QSslError> & ) ) );
    5. this->QWebView::load( url );
    6. }
    7.  
    8. void
    9. MyQWebView::sslErrorHandler( QNetworkReply *reply, const QList<QSslError> &errors )
    10. {
    11. reply->ignoreSslErrors( errors );
    12. }
    To copy to clipboard, switch view to plain text mode 

    This allows the webview to load the page even if there is some ssl handshake errors

    Thanks Wysota for ur help

    Regards,
    Márwyn
    Last edited by marwyn; 26th August 2011 at 14:23.

Similar Threads

  1. QWebView doesn't load a page on windows
    By RzuF in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2011, 21:09
  2. Replies: 1
    Last Post: 24th March 2011, 16:40
  3. designer plugin fails to load
    By ModeZt in forum Qwt
    Replies: 6
    Last Post: 4th February 2008, 21:08
  4. [mac] QImage.load fails
    By snoopy67 in forum Qt Programming
    Replies: 4
    Last Post: 7th November 2007, 14:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.