1
如何在pywebkit中为file://协议启用xmlhttprequest?python webkitgtk xmlhttprequest文件协议
就像Chrome并
http://www.google.com/support/forum/p/Chrome/thread?tid=171316324d16747b&hl=en
如何在pywebkit中为file://协议启用xmlhttprequest?python webkitgtk xmlhttprequest文件协议
就像Chrome并
http://www.google.com/support/forum/p/Chrome/thread?tid=171316324d16747b&hl=en
设置上WebView
的enable-file-access-from-file-uris
属性:
view = webkit.WebView()
settings = view.get_settings()
settings.set_property('enable-file-access-from-file-uris', 1)
view.open('file://./foo.html')
示例文件foo.html
其写入的内容file://./bar.html
进入人体:
<html>
<head><script type="text/javascript" src="jquery-1.4.4.js"></script></head>
<body><script>
$.ajax({url: 'file://./bar.html', success: function(data) {
document.write(data);
}
});
</script></body></html>
谢谢谢谢你 – znetor 2011-05-19 22:59:31
@znetor不客气,祝你的程序好运! – samplebias 2011-05-19 23:07:26