k99*_*k99 1 python gtk webkit xmlhttprequest file-uri
如何在pywebkit中为file://协议启用xmlhttprequest?
就像铬一样
http://www.google.com/support/forum/p/Chrome/thread?tid=171316324d16747b&hl=en
设置enable-file-access-from-file-uris属性WebView:
view = webkit.WebView()
settings = view.get_settings()
settings.set_property('enable-file-access-from-file-uris', 1)
view.open('file://./foo.html')
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1054 次 |
| 最近记录: |