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