python webkitgtk xmlhttprequest file protocol
How to enable xmlht开发者_开发百科tprequest for file:// protocol in pywebkit ?
just like chrome does
http://www.google.com/support/forum/p/Chrome/thread?tid=171316324d16747b&hl=en
Set the enable-file-access-from-file-uris
property on WebView
:
view = webkit.WebView()
settings = view.get_settings()
settings.set_property('enable-file-access-from-file-uris', 1)
view.open('file://./foo.html')
Example file foo.html
which writes contents of file://./bar.html
into the body:
<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>
精彩评论