Languages

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.
 
Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

3 Replies
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