Results 1 to 2 of 2

Thread: QtWebKit access HTML manipulated by javascript

  1. #1
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QtWebKit access HTML manipulated by javascript

    hi there,

    I want to build a WebKit app that loads a webpage, allows the user to interact with the webpage, and then saves the current HTML of the webpage.

    If the webpage HTML is manipulated with JavaScript, is there a way to access the updated HTML? Or only the original HTML source?

    thanks,
    Richard

  2. #2
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtWebKit access HTML manipulated by javascript

    For example if I have a QWebView:
    Qt Code:
    1. QString webhtml = webView->page()->currentFrame()->toHtml();
    To copy to clipboard, switch view to plain text mode 
    if this is executed after the javascript modifies the page, then the modified html will be in the string.

    You can also use javascript in the page like this:
    Qt Code:
    1. javascript = QString("javasciptfunctiontoexecute()");
    2. QVariant javascriptreturnvalue = webView->page()->currentFrame()->evaluateJavaScript(javascript);
    3. dosomethinginQt(javascriptreturnvalue.toString());
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to tpf80 for this useful post:

    rbp (3rd February 2010)

Similar Threads

  1. QTWebKit, out of control Javascript CPU usage
    By Dkamerad in forum Qt Programming
    Replies: 2
    Last Post: 12th December 2014, 06:01
  2. How to access DOM of a web page in QtWebKit?
    By piotr.dobrogost in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2011, 10:23
  3. QtWebkit and JavaScript error messages
    By Diph in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2009, 12:10
  4. add custom HTML attribute by javascript in QtWebKit
    By sand.fj.wen in forum Qt Programming
    Replies: 3
    Last Post: 17th April 2009, 08:25

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.