Results 1 to 1 of 1

Thread: Reparse HTML buffer with QWebKit support

  1. #1
    Join Date
    Jan 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Reparse HTML buffer with QWebKit support

    Hi.
    I need to process potentially uncorrect HTML markup and get like-WebKit 'dirty-mode' XHTML (optionally, HTML).
    I don't need to process non-html blocks (scripts, styles - keep as is).
    What i do:
    //////////////////////////////
    QWebPage page;
    page.setHtml( content );

    ...onFinishLoading( bool )
    {
    page.mainFrame()->toHtml();
    }
    //////////////////////////////
    But it doesn't work. For a simple raw html code it works fine.
    But when i try to parse any URL content (wiki for example), it return's false in onFinishLoading and <html></html>


    Added after 1 58 minutes:


    Thanks all.
    I've found solution.
    These lines must be added before call to skip non-HTML processing.

    QWebSettings * settings = QWebSettings::globalSettings();
    settings->setAttribute(QWebSettings::AutoLoadImages, false);
    settings->setAttribute(QWebSettings::JavascriptEnabled, false);
    settings->setAttribute(QWebSettings::JavaEnabled, false);
    settings->setAttribute(QWebSettings::PluginsEnabled, false);
    settings->setAttribute(QWebSettings::PrivateBrowsingEnabled , true);
    Last edited by saxon; 19th January 2012 at 00:38.

Similar Threads

  1. How to combine multiple .html files together into one .html
    By stella1016 in forum Qt Programming
    Replies: 3
    Last Post: 12th October 2011, 06:34
  2. cURL & QWebKit don't mix
    By Frankenstein Coder in forum Newbie
    Replies: 1
    Last Post: 20th July 2011, 03:03
  3. Is it possible to embed html with js into QwebKit
    By umen in forum Qt Programming
    Replies: 0
    Last Post: 24th October 2010, 06:56
  4. Is there a widget fully support html in QT4?
    By hashb in forum Qt Programming
    Replies: 2
    Last Post: 15th October 2009, 02:05
  5. Hacking QWebkit
    By qtfeeder in forum Qt Programming
    Replies: 4
    Last Post: 8th July 2009, 17:54

Tags for this Thread

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.