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

Daniel Jalkut jalkut at red-sweater.com
Fri Jun 25 06:27:43 PDT 2010


On Jun 25, 2010, at 9:19am, Alexander Shulgin wrote:

> On 24.06.2010 22:37, Dan Wood wrote:
>> 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 pretty much believe it is blocked for security reasons, as I ended up debugging similar issue just recently.

I have run into this as well. It's inconvenient, especially since I the security risk is low to my users, who are providing all the HTML content for the WebView themselves.  Since my app shows users a preview of what their web page will look like, it makes sense to use their web page URL as the base URL, but some users like to use file:// based style sheets and other assets, to improve performance, and allow offline functionality.

One thing I discovered in researching this issue is that the security policy change is made dynamically at runtime, and is based on the OS or version of WebKit installed on the machine you are compiling on (can't remember which, or even if this is 100% accurate). But the end result is that if you go back and compile your app on 10.5, say, you will get the old security behavior, even when your app is running on 10.6 or with the latest WebKit.

Unfortunately, I don't think there is a programmatic way to specifically revert to the old security policy.

Daniel



More information about the webkit-help mailing list