Results 1 to 3 of 3

Thread: How to follow a link in QWebKit?

  1. #1
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default How to follow a link in QWebKit?

    Having a DOM of the following html;

    Qt Code:
    1. <a href="?op=order">
    2. <img class="img_button" src="picture.gif"
    3. onMouseOver="this.src='some.gif';"
    4. onMouseOut="this.src='some_other.gif';"
    5. alt="" border="0">
    6. </a>
    To copy to clipboard, switch view to plain text mode 
    how to follow a link (href) in QWebKit (specifically QWebPage).

    Please notice that it's an image that is linked.
    I can't do it (and I don't want to even if I could) by simulating a mouse click as I don't use QWebView thus I don't have the page rendered.

  2. #2
    Join Date
    Jul 2009
    Posts
    139
    Thanks
    13
    Thanked 59 Times in 52 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to follow a link in QWebKit?

    My javascript is a little rusty but something like:
    Qt Code:
    1. // 0 is the index number of the anchor you want to follow.
    2. // You could also use a name.
    3. window.document.location.href = window.document.anchors(0).href;
    To copy to clipboard, switch view to plain text mode 
    should do the trick. Alternatively, you can try:
    Qt Code:
    1. window.document.anchors(0).click();
    To copy to clipboard, switch view to plain text mode 
    Use the evaluateJavaScript function.

  3. #3
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to follow a link in QWebKit?

    Sorry but what do you mean by follow a link ?

Similar Threads

  1. LINK : fatal error LNK1181: can't open 'delayimp.lib'
    By fcamlar in forum Installation and Deployment
    Replies: 10
    Last Post: 7th July 2006, 14:04
  2. Text Browser Link Question
    By taylor34 in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2006, 20: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.