[webkit-dev] RE: how can I callback javascript function from webkit engine?

cloud zheng cloud.zheng at borqs.com
Thu Dec 27 05:24:56 PST 2007

Hi, Alp Toker,

Thank you so much. You are a great help. :-)

Regards and thanks

-----Original Message-----
From: Alp Toker [mailto:alp at atoker.com]=20
Sent: 2007=C4=EA12=D4=C227=C8=D5 5:10
To: Jing Zheng
Cc: webkit-dev at lists.webkit.org
Subject: Re: how can I callback javascript function from webkit engine?

Jing Zheng wrote:
> hi,
> I am working on an porting application that using webkit engine to=20
> render a html page in my application view.
> now I am stuck in the problem that I can not find a way to call=20
> javascript function defined in html script from my application.


If you're using a WebView-style port (Mac, Win, GTK+) you can access the =

  the JSGlobalContextRef holding the global object/state and JSObjectRef =

representing the frame's JavaScript window object with the=20
window-object-cleared signal/callback/event, which is raised in=20
preparation for a new load.

You can also access the JSGlobalContextRef at other times using=20
webkit_web_frame_get_global_context() / WebFrame::globalContext() or=20

Once you have these objects, you can use the standard portable=20
JavaScriptCore API documented here:


I'm planning to write a tutorial on this since it's a frequently asked=20

Good luck!

More information about the webkit-dev mailing list