I don't really understand your question, but here are some good examples of how to use javascript core:
http://parmanoir.com/Taming_JavascriptCore_within_and_without_WebView If you are trying to call javascript on a page from native code, JavascriptCore, lets you create a native object that will be visible as a javascript object on a webpage. You can define callbacks for your objects properties or call functions on it All this is detailed in the link above. I've gotten it working in Mac and Windows without too much trouble. Chris 2012/3/12 <bins_m...@sina.com> > > > Dear Sirs: > I decide to use the JavascriptCore's API of the Webkit-1.2.7 to do > some interactions between C code and javascript. Now I find it difficultied > to get an appropriate JSContextRef when I intend to use it to call a > Javascript function in the native C method. I have tried some functions in > the JSContextRef.h, but it seemed that did not work well. > Here is part of my codes: > ... > static void > on_foo(gpointer user_data) > { > ... > JSGlobalContextRef context = JSGlobalContextCreateInGroup(NULL, NULL); > > JSStringRef body = JSStringCreateWithUTF8CString("alert(\"Hello > World\");"); > > JSObjectRef function = JSObjectMakeFunction(context, NULL, 0, NULL, > body, NULL, 0, NULL); > > JSValueRef result = JSObjectCallAsFunction(context,function, NULL, 0, > NULL, 0); > ... > } > ... > on_foo is a native callback in C code part and it seems that the > javascript function "alert()" will not be called due to the context object > not handling well. So how should I modify my code to build a right > jscontext ref ? > > Thanks. > > _______________________________________________ > webkit-help mailing list > webkit-help@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-help > >
_______________________________________________ webkit-help mailing list webkit-help@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-help