thinblog / pywebkitgtk

Automatically exported from code.google.com/p/pywebkitgtk
Other
0 stars 0 forks source link

no xmlhttprequest for file:// protocol? #61

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I use some ajax like

xmlhttp.open("GET","test1.txt",false);

find some question on chrome
http://www.google.com/support/forum/p/Chrome/thread?tid=171316324d16747b&hl=en

how to open --allow-file-access-from-files in pywebkit?

thx~

Original issue reported on code.google.com by zne...@gmail.com on 19 May 2011 at 6:14

GoogleCodeExporter commented 8 years ago
As a workaround for this, I override window.XMLHttpRequest with my own class 
that uses document.title to send commands to a notify::title signal callback on 
the python side. Then the python side uses a WebKit.execute_script() call reply 
to the request. For example code, see my commit here:

http://code.google.com/p/electroshocktherapy/source/detail?r=438ae49894167b9f79c
360dc002d6820d957e39b

This allows me use file:/// URIs entirely (removing an http server from my 
app), which greatly reduces page loading overhead. It a little bit ugly, but it 
works very well.

Original comment by zmedico on 3 Feb 2012 at 10:01