Closed GoogleCodeExporter closed 9 years ago
its a bit of a hack but you can do this by adding a handler for the
navigation-requested event on the WebView....
def _navigation_requested_cb(view, frame, networkRequest):
# get uri from request object
uri=networkRequest.get_uri()
print "request to go to %s" % uri
# load the page somehow.....
page=urllib.urlopen(networkRequest.get_uri())
# load into associated view, passing in uri
view.load_string(page.read(), "text/html", "iso-8859-15", uri)
# return 1 to stop any other handlers running
# eg. the default uri handler...
return 1
this would be pretty easy to pick out the desired protocols and return False
for the
rest (leaving the default behaviour)
Original comment by mbull.pe...@gmail.com
on 22 May 2009 at 11:23
mbull, Thanks for that. I added your suggestion to the FAQ
(http://code.google.com/p/pywebkitgtk/wiki/HowDoI?ts=1243548256&updated=HowDoI).
Original comment by jmalo...@gmail.com
on 28 May 2009 at 10:06
I just quickly tried this in my app, and it works for the main page, but this
event
is not triggered for resources referenced by the page (an external javascript
file in
my case).
Original comment by uhm...@gmail.com
on 29 Jul 2009 at 1:49
Is there a way to intercept a request for resources referenced by a page? I
want to
handle those resources from my program, similar to what uhmmmm wanted to do,
but I
can not find the correct API from webkitgtk reference manual. I guess it will
be hard
to add this functionality to webkit.
Original comment by smartke...@gmail.com
on 12 Feb 2010 at 11:42
There is - have a read at http://webkitgtk.org/reference/webkitgtk-
WebKitWebView.html#WebKitWebView-resource-request-starting.
Original comment by jmalo...@gmail.com
on 12 Feb 2010 at 9:39
as I said in webkit-gtk ML <
https://lists.webkit.org/pipermail/webkit-gtk/2010-April/000193.html
this is very trivial in PyQt, we need to make it so in gtk version too!
http://diotavelli.net/PyQtWiki/Using%20a%20Custom%20Protocol%20with%20QtWebKit
Original comment by als...@gmail.com
on 17 Apr 2010 at 3:12
my pywebkitgtk version 1.0.1 and the docs says it's in "Since 1.1.14"
so can we say that why I asked (which includes being able to handle ajax
requests) is
already solved.
if not, should I re-open this or port a new issue ?
Original comment by als...@gmail.com
on 17 Apr 2010 at 3:21
For anyone arriving at this ticket and still unsure how to go about this, see
my comment on the HowDoI page regarding resource-request-starting.
Original comment by mackst...@gmail.com
on 24 Jul 2010 at 5:32
Original issue reported on code.google.com by
jmalo...@gmail.com
on 22 Jun 2008 at 8:50