[webkit-gtk] Get result of JavaScript execution

Jiahua Huang jhuangjiahua at gmail.com
Thu May 13 05:39:01 PDT 2010


I use python-jswebkit to do it
https://launchpad.net/ubuntu/+source/python-jswebkit
http://code.google.com/p/gwrite/downloads/detail?name=python-jswebkit-0.0.2.tar.gz
http://code.google.com/p/gwrite/downloads/detail?name=python-jswebkit_0.0.2-1_i386.deb

example:
http://code.google.com/p/gwrite/source/browse/gwrite/webkitedit.py

import webkit
import jswebkit

class WebKitEdit(webkit.WebView):
    '''Html Edit Widget
    '''
    def ctx(self, *args):
        '''get javascript ctx obj
        '''
        ctx = jswebkit.JSContext(self.get_main_frame().get_global_context())
        return ctx

    def eval(self, js):
        '''use ctx to evaluate javascript

        Get result of JavaScript execution
        '''
        return self.ctx().EvaluateScript(js)


More information about the webkit-gtk mailing list