开发者

Using local path with WebView (Webkit)

开发者 https://www.devze.com 2022-12-13 05:32 出处:网络
I\'m trying to use Gtk port of Webkit. All works fine. But when I\'m using local path in src attribute to load image from my HDD (src=\"file://...\") I\'m getting the next warning in console:

I'm trying to use Gtk port of Webkit. All works fine. But when I'm using local path in src attribute to load image from my HDD (src="file://...") I'm getting the next warning in console:

not allowed to load local resou开发者_JS百科rce file://...

And image doesn't loading. Any suggestions?

P.S. I'm using load_string method with fake base url (fake://url).


If you use "file://" as the base URL, then it should work. It's unclear to me whether this is a bug and whether it should also work if the base URL is NULL (it doesn't), but see the discussion starting here on the webkit-dev mailing list.


WebKitWebSettings *s = webkit_web_settings_new();
g_object_set(G_OBJECT(s),"enable-file-access-from-file-uris", TRUE, NULL);
webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webkit),s);
0

精彩评论

暂无评论...
验证码 换一张
取 消