2
import webkit
import gtk
import jswebkit
webview = webkit.WebView()
webview.connect('load-finished', lambda v, f: gtk.main_quit())
# How can I set user-agent ?
webview.load_uri('http://localhost/tech/test.html')
gtk.main()
js = jswebkit.JSContext(webview.get_main_frame().get_global_context())
renderedBody = str(js.EvaluateScript('document.body.innerHTML'))
print renderedBody
我想爲webkit.WebView設置像「iPad」或其他的用戶代理,我該怎麼辦?如何在python-webkit中設置用戶代理