语言

Menu
Sites
Language
How to load local images or html on WebView

I want to load html file or images on WebView which is stored on local path like

   '/opt/apps/{app id}/data/test.html'

   '/opt/apps/{app id}/res/test.html'

In Bada forum, I found that the local path '/Home' or '/Res' are used to do it.
 
Tizen::Web::Controls::Web* pWeb = new Tizen::Web::Controls::Web();
pWeb->Construct(Rectangle(0, 0, GetWidth(), GetHeight()));
AddControl(*pWeb);
pWeb->LoadUrl(L"/Home/test.html");

 

When I tried like that, WebView shows dialog box.

==================================
   Select Application
--------------------------------------------
   Email
   Bluetooth
                              Cancel
 ==================================
 
Thanks in advace.
 
编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

3 回复
john Smith
Hi, we can use _pWeb->LoadUrl(L"file://"+url); to load the html file. Thanks
Byungkwon Kim
Thanks John. It works when I use absolute url like this.. pWeb->LoadUrl(L"file:///opt/usr/apps/{app Id}/res/test.html"); Also, I can access other application's res file using absolute url without any restrictions. pWeb->LoadUrl(L"file:///opt/usr/apps/{other app Id}/res/screen-density-xhigh/00_search_icon.png"); Is there no way to prevent from other applications access to my res files. Thanks.
dhirku
This looks like a bug .... even data folder is accessible using LoadUrl. I have raised a bugreport .... https://bugs.tizen.org/jira/browse/TDIST-186