[webkit-qt] Emulate click event with QWebElement::evaluateJavaScript

Benjamin Poulain benjamin.poulain at nokia.com
Wed Jan 5 04:25:09 PST 2011


On 01/05/2011 09:14 AM, ext Tr3wory wrote:
> On Wed, Jan 5, 2011 at 1:05 AM, Benjamin Poulain
> <benjamin.poulain at nokia.com>  wrote:
>> The example is on an input element. Those elements have a click() method,
>> not link elements (see the DOM specification).
>
> It's interesting, because it's just works in Opera.
> I can't find it in the w3 specification, but on a lots of other places
> I can find a click() method in HTMLAnchorElement which is an inherited
> function from HTMLElement, and it looks like all the major browsers
> supports it (for example Safari from 1.0).

See http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-48250443

I just found this behavior is re-defined in the HTML 5 spec:
http://dev.w3.org/html5/spec/Overview.html#htmlelement

This does not seem to supported yet by WebKit however:
https://bugs.webkit.org/show_bug.cgi?id=27880

>> I do not know if there is a simple way to activate a link programmatically. You could execute the event
>> handler, and load href by default, or send a syntethic mouse event.
> Yes, but I want to use QWebPage without any visible window...

The workaround I mentioned do not require a visible window.

cheers,
Benjamin


More information about the webkit-qt mailing list