[webkit-help] How to load a file:// image from a webview loaded with a base URL?

Dan Wood dw43031apple at karelia.com
Thu Jun 24 12:37:33 PDT 2010


I'm seeing an odd behavior, and I wonder if it is a regression in Safari 5's webkit, and if there is a workaround.

I have an HTML string which I have loaded up from a remote website, and modified slightly to include an image with a source of a local file:// URL.

Then I try to load it into my webview with -[WebFrame loadHTMLString:baseURL:]. I pass in the base URL so that the images with relative paths will show properly.

This works fine, except that my file:// image does not load!  It's not even requested, if I monitor the resource load delegate!

The markup seems fine, and it has definitely been parsed when I examine my WebView with the inspector.  Just, no request for the image.

If I try to load the HTML with a nil base URL, then my file://-URL-based image shows up just fine.


This seems like either like a regression -- I can't believe that a base URL would affect being able to load up a local URL.  Or is this actually as expected?

Any ideas on a workaround?  (I tried splicing in <base href=...> instead of the base URL; the problem is that the initial request becomes about:blank, so links to "#" sections don't work.  I guess I can put my local image up on the web...)


--
Dan Wood
Twitter: http://twitter.com/danwood
Karelia Software — Sandvox for the Mac
http://www.karelia.com/

It is time we steered by the stars and not by the lights of each passing ship - General Omar Bradley




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100624/05915950/attachment.html>


More information about the webkit-help mailing list