[webkit-help] How to call JavaScript function from WebKit

Julien Chaffraix julien.chaffraix at gmail.com
Mon Jun 20 07:03:48 PDT 2011

[Please don't cross post on webkit-dev & webkit-help. If it does not
involve developing WebKit itself, webkit-dev should not be included.]

2011/6/20 achellies <achellies at 163.com>:
> you can call as the following:

[snipped code]

> anyone help me, how to call JavaScript function from webkit and give the
> example code..

Achellies gave you a way using the API inside WebCore. There is no
guarantee that the API will stay stable over time as WebCore is
internal is under heavy development. Unless the code is internal to
WebKit, I would advice not to use that.

Depending on the port of WebKit, you are using there may be another
way (see http://www.webkit.org/asking_questions.html). There is a way
to inject user scripts into the current page but it needs to be
exposed to the API. Some ports also expose the C++ <-> JavaScript
bridge (mostly useful if you control the page you load). Finally if
you use only the JS engine, JSC and V8 have a way to do that.

Hope it helps,

More information about the webkit-help mailing list