【发布时间】:2011-08-28 17:17:09
【问题描述】:
如何在pywebkit中为file://协议启用xmlhttprequest?
就像 chrome 一样
http://www.google.com/support/forum/p/Chrome/thread?tid=171316324d16747b&hl=en
【问题讨论】:
标签: python webkit gtk xmlhttprequest file-uri
如何在pywebkit中为file://协议启用xmlhttprequest?
就像 chrome 一样
http://www.google.com/support/forum/p/Chrome/thread?tid=171316324d16747b&hl=en
【问题讨论】:
标签: python webkit gtk xmlhttprequest file-uri
在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>
【讨论】: