<div dir="ltr">Just to let you know... I figure out how the library which I use to render ePub files parses the content of .html files and produces absolute URLs for loading, followed by resolving it. So I guess it's necessary to have absolute URLs. This solved my issue as I'll use it like that. <div>
<br></div><div>Sorry for bothering and thanks for help.</div><div><br></div><div>Regards,</div><div><br></div><div>Marta </div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px; max-height:0px;" src="https://mailfoogae.appspot.com/t?sender=abWFydGEubWlsYWtvdmljQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=b0a4acb8-b936-4e9f-b556-da8db6b7426d"><font color="#ffffff" size="1">ᐧ</font></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 24, 2014 at 12:01 PM, Marta Milaković <span dir="ltr"><<a href="mailto:marta.milakovic@gmail.com" target="_blank">marta.milakovic@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yeah, sorry, I made a little bit messy mail. Small explanation of what I did.<div><div>
<br></div><div>I am using <i><a href="http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebContext.html#webkit-web-context-register-uri-scheme" target="_blank">webkit_web_context_register_uri_scheme</a></i> to register my scheme, lets say <i>book</i>. Then I make an URL request with the registered scheme for the <i>html</i> file <i><b>ex1.html</b></i>: <i>webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "book:ex1.html").</i></div>
<div><i><br></i></div><div>Two cases are:</div><div><i>1. <b>ex1.html</b></i> file contains relative path to the image:</div><div><i> <img src="</i>img<i>.jpg" alt="title page"/></i></div><div>
<div>
<i>2. <b>ex1.html</b></i> file contains absolute path to the image:<br></div></div><div><div><i> <img src="book:</i>img<i>.jpg" alt="title page"/></i><br></div><div></div></div><div><br></div><div>
In the first case when I use a relative path <span><a href="http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebContext.html#WebKitURISchemeRequestCallback" title="WebKitURISchemeRequestCallback ()" target="_blank"><i>WebKitURISchemeRequestCallback</i></a> isn't being called.</span> </div>
<div>In the other case, when I use an absolute path (with the registered scheme) the callback is called.</div><div><br></div><div>The question is why doesn't it work for the first case? Of course, if I check document.URL it gives: book:ex1.html, so the requested URL should be book:img.jpg.</div>
<div><br></div><div>Thanks for the answers,</div><div><br></div><div>Marta</div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px" src="https://mailfoogae.appspot.com/t?sender=abWFydGEubWlsYWtvdmljQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=a2824fac-4c6e-43bf-8781-7bb4b2b85255"><font color="#ffffff" size="1">ᐧ</font></div>
<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Tue, Jun 24, 2014 at 12:33 AM, Robert Schroll <span dir="ltr"><<a href="mailto:rschroll@gmail.com" target="_blank">rschroll@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On Sun, Jun 22, 2014 at 3:30 AM, Marta Milaković <<a href="mailto:marta.milakovic@gmail.com" target="_blank">marta.milakovic@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I would like to know if there a way I could redirect all the requests to use predefined URI scheme? Or maybe you know of some other solution that might work.<br>
</blockquote>
<br></div>
I admit that I don't quite understand the question, so I may be telling you something irrelevant, but: By connecting to the resource_request_starting signal of your WebView, you can intercept and manipulate any request as it's going out. We use this in Geary to allow the loading of only white-listed resources. In the HTML, we added a special URI scheme to these resources. Then, in the resource_request_starting handler, we block all requests without that scheme and strip that scheme off white-listed requests before allowing them to continue. Maybe you can do something similar? Our code is here: <a href="https://git.gnome.org/browse/geary/tree/src/client/conversation-viewer/conversation-web-view.vala#n92" target="_blank">https://git.gnome.org/browse/<u></u>geary/tree/src/client/<u></u>conversation-viewer/<u></u>conversation-web-view.vala#n92</a><br>
<br>
That said, I'm not sure why you want to avoid having a HTTP server. About a year ago, I spent a weekend throwing together a basic Epub reader using Python and WebKitGTK. It was pretty easy to make a simple server that returned bits of the Epub file as they were needed. I guess there's no use in letting that code rot on my machine, so I've thrown it up on Github: <a href="https://github.com/rschroll/berg" target="_blank">https://github.com/rschroll/<u></u>berg</a>. Please take whatever you'd like from it -- I'm excited that GNOME will be getting a first-class Epub reader!<br>
<br>
Hope that helps,<br>
Robert<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Marta Milaković
</font></span></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Marta Milaković
</div>