[webkit-dev] "link-following" feature for our new webkit browser

Jan jouzar at googlemail.com
Mon May 4 05:52:39 PDT 2009


Hi there,
I'm contributing to a project called "uzbl" [1]. It uses webkit(gtk) to
render content.
I tinker on a "follow-link" feature, which should provide a keyboard
driven link navigation, very similar to the firefox plugin "Hit-a-Hint"
[2] or "Vimperator" [3]. Since GObject/C DOM bindings probably take 
some time to be released [4], we started with some basic javascript-
hacking through webkit_web_view_execute_script:

1. Mark all links with its index in document.links:
> for (var i=0; i < document.links.length; i++)
> { var li = document.links[i]; li.innerText = i+' '+li.innerText; };
2. Go to link $i:
> window.location = document.links[i].href;
This isn't nice at all, becaus it doesn't work with ajax-ish webpages.
As an alternative we imagined this would be the best solution:
2. Request link $i:
> document.links[i].click();
But click() in webkit is not for A elements, just for buttons.

I would love to hear your opinion about this - is there a way to
simulate a proper mouseclick on a link in webkit? Or do you see other
ways to achieve this feature in webkit?

[1] http://www.uzbl.org/
[2] http://hah.mozdev.org/
[3] http://vimperator.org/
[4] https://bugs.webkit.org/show_bug.cgi?id=16401


More information about the webkit-dev mailing list