[webkit-dev] extend javascript inside iframes, and hide cursor

scostas scostas at det.uvigo.es
Tue Jul 14 09:03:54 PDT 2009


Hi all:

I'm working with GTK-Webkit and I have two questions:

a) I added a new javascript class, and it works fine, but when I run the 
webpage inside an iframe, it doesn't work. How have I to add the new 
class and object to make it work in the iframes too?

I add the new class with this code, responding to the 
window-object-cleared signal.

     WebKitWebFrame* frame = webkit_web_view_get_main_frame (web_view);
     JSGlobalContextRef js_context = 
webkit_web_frame_get_global_context(frame);

     JSObjectRef js_object=JSContextGetGlobalObject(js_context);

     js_class = JSClassCreate (&my_jsclass_def);
     class_string = JSStringCreateWithUTF8CString("MYCLASS");
     js_object2 = JSObjectMake (js_context, js_class, NULL);

     JSObjectSetProperty(js_context, js_object, class_string, 
js_object2, kJSPropertyAttributeNone, NULL);

(well, there is more code to avoid re-creating the class and the object 
everytime a new page is loaded, but you catch the idea...).

b) How can I hide the cursor when it's into the webkit widget? I've been 
able to hide it when it's in other GTK widgets, but as soon as it enters 
the browser, it's visible again.

Thanks!


More information about the webkit-dev mailing list