언어 설정

Menu
Sites
Language
using Web control to load local resoruce

Hi,

 

I would like to use Web control to load a local html file instead by http.

 

__pWeb = new Web();
__pWeb->Construct(GetClientAreaBounds());
__pWeb->LoadUrl("file://doc.html); // sth like that

 

How set path for LoadUrl and where put html file?

 

Thanks.

 

Regards,

slaw

 

 

 

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

10 댓글
Pushpa G
yes, try this: Tizen::Web::Controls::Web* __pWeb = static_cast(GetControl(L"IDC_WEB1")); // or __pWeb = new Web(); //__pWeb->Construct(GetClientAreaBounds()); if(__pWeb != null) { __pWeb->LoadUrl(L"file:///opt/usr/apps/zZ2niRppOY/res/indexone.html"); } else { AppLog("Web not initialized"); }
Pushpa G
You can store the html file in the above said location(In connection explorer>device/emulator icon>opt/usr/apps/your app_id/res/file.html") Also refer to this :https://developer.tizen.org/forums/native-application-development/how-load-local-images-or-html-webview
Slawek Kowalski
Yes, you are right. Finally, it works great: const Tizen::Base::String DOC_HTML = L"doc.html"; ... __pWeb = new Web(); __pWeb->Construct(GetClientAreaBounds()); AddControl(__pWeb); // add to my Form Tizen::Base::String appid = App::GetInstance()->GetAppId(); // returns sth like "aasdgKkwk.ApplicationName", must cut off after dot appid = L"aasdgKkwk"; // better to use GetAppId and remove sequence from dot Tizen::Base::String url; url.Format(100, L"file:///opt/usr/apps/%S/res/%S", appid.GetPointer(), DOC_HTML.GetPointer()); __pWeb->LoadUrl(url); I am curious why App::GetInstance()->GetAppId() return app-id + "." + appName at end? In manifest file app-id stays without application name.
Pushpa G
Try this, it gives just the appid in the manifest file: AppId obj = App::GetInstance()->GetAppId(); AppLog("This app's main appid is %ls",obj.GetPointer()); PackageId id = Tizen::App::Package::PackageManager::GetPackageIdByAppId ( obj ) ; AppLog("This app's package id is %ls",id.GetPointer()); So i guess appid contains appid.appname and package id is the exact app package id
Slawek Kowalski
Checked. You are right. This line: Tizen::App::Package::PackageManager::GetPackageIdByAppId ( obj ) returns pure id as manifest stay. Thanks.
Pushpa G
thank you too:)
Slawek Kowalski
I tested or ref device PQ Tizen 2.2. It dosen't work on device. I got black or white (depends on theme) web container. I put privilage: http://tizen.org/privilege/web.service. passed url: file:///opt/usr/apps/yDBJhKptTq/res/doc.html I'm curious why works on emulator but not device?
Pushpa G
Dear Kowalski, I want to know, have you pushed the file doc.html first(before running your app) in the device by going to connection explorer>device icon>opt>usr>apps>your_Appid>res> here.
Slawek Kowalski
I put file doc.html into opt/user/apps/myAppID directly by connection explorer - still nothing, white screen only. Doc.html file is installed together with apk packgage, I don't know what you mean. File is placed in res/ folder. On emulator works perfect. I can't open any url address by tizen's browser. Browser (named as Internet)opens ok, I got internet connection by wifi but after entering any http address the browser exits with message like "Internet has closed unexpectedly". Maybe that is connected with web control issue? Thanks.
Slawek Kowalski
I found solution: https://developer.tizen.org/forums/native-application-development/internet-has-closed-unexpectedly-device-u1hd I tried to install Mali DDK many times but after start device hangs at tizen's logo. I used that guide: https://source.tizen.org/documentation/reference/flash-device#install-mali-ddk