Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Use javaScript to click on a link
Forum Update on Monday, May 27th 2025

Use javaScript to click on a link

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 2 Posters 994 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yearl
    wrote on 27 Feb 2015, 12:34 last edited by
    #1

    In examples browser,I want to click a link automaticly.

    In Qt5.0,
    call
    evaluateJavaScript("document.getElementById('dd').click();");
    on
    <a id="dd" href="http://qt-project.org">DD</a>
    It works fine.I can open the link in the same tab.

    But when I run the same code on
    <a id="dd" href="http://qt-project.org" target="_black">DD</a>
    nothing happened.

    in Qt 4.0,everything is fine,I can open the link, with or without target="_black"

    1 Reply Last reply
    0
    • T Offline
      T Offline
      ThatDude
      wrote on 2 Mar 2015, 16:38 last edited by
      #2

      You probably wanted target="_blank"
      or you don't have frame with that name "_black"
      or due to security restrictions originating frame (e.g. main frame) doesn't have access to the other frame ( "_black")

      http://www.w3schools.com/tags/att_a_target.asp

      1 Reply Last reply
      0

      2/2

      2 Mar 2015, 16:38

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved