在WebView中使用本地路径(Webkit) [英] Using local path with WebView (Webkit)

查看:530
本文介绍了在WebView中使用本地路径(Webkit)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Webkit的Gtk端口。一切正常。但是,当我在src属性中使用本地路径从我的硬盘加载图像时(src =file:// ...),我在控制台中收到下一个警告:


不允许加载本地资源
file:// ...

和图像不加载。有什么建议?



P.S 。如果你使用<$ c $,那么你可以使用<$ c $> c>file://作为基本URL,那么它应该工作。我不清楚这是否是一个bug,如果基本URL是 NULL (它没有),它是否也可以工作,但看到讨论开始这里是webkit-dev邮件列表


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 resource 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.

这篇关于在WebView中使用本地路径(Webkit)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆