Results 1 to 2 of 2

Thread: QWebView html is empty

  1. #1
    Join Date
    Dec 2012
    Posts
    2
    Qt products
    Qt4

    Default QWebView html is empty

    Hi

    I just want to see/save the html code from a Webpage, but I have one Problem:

    Only result that I get is: <html><head></head><body></body></html>

    My code looks like :
    //(for testing i put the code in main.cpp)

    QWidget * parent;
    QWebView * view = new QWebView(parent);

    QNetworkAccessManager *nam = new QNetworkAccessManager;
    QNetworkReply *reply = nam->get(QNetworkRequest(QURL..));

    If I write a localfile address like:

    QUrl::fromLocalFile("/home/../page.html")

    the result is the whole html code, but if I write "http://website.com"

    the result is:
    <html><head></head><body></body></html>

    for the output i wrote:
    qDebug() << QString::fromUtf8(reply->readAll());

    I also tried with view->page()->currentFrame()->toHtml(); //same with mainFrame() and ->documentElement()->toPlainText and toOuter/toInnerXml()...

    and with view->show(); I can still see the website...
    The website is http and not https, so i dont need ssl auth etc.


    Can someone help me pls?




    greets

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QWebView html is empty

    Are you sure that the webview has finished loading when you call toHTML?

    Cheers,
    _

Similar Threads

  1. QWebView html is empty
    By therealko in forum Qt Webkit
    Replies: 0
    Last Post: 19th December 2012, 13:16
  2. Replies: 1
    Last Post: 5th December 2012, 09:19
  3. QWebView - How to get DOM HTML
    By lhg in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2011, 19:16
  4. [4.7] QWebView + Qt aware HTML
    By bunjee in forum Qt Programming
    Replies: 0
    Last Post: 25th October 2010, 10:49

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.