Languages

Menu
Sites
Language
Can Web control load Tizen Web app or page

Hi,

   I wrote a Tizen Web application and it used some tizen system class and API, for example: tizen.ApplicationControl. Could the web control in a native application load the web page and execute  javascript successfully? thanks.

 

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

Responses

2 Replies
You can execute javascript from native app.
using namespace Tizen::Ui;
using namespace Tizen::Web::Controls;

// The path to your Web App (in this example: res/index.html)
String url(L"file://" + GetAppResourcePath() + L"index.html");

// Create form
Form pForm = new Form();
pForm->Construct(FORM_STYLE_NORMAL);

// Create Web Control
Web* pWeb = new Web;
pWeb->Construct(Rectangle(0, 0, 700, 700));
pForm->AddControl(pWeb);
pWeb->LoadUrl(url);

// Wait until the page is loaded

// Call JavaScript function in index.html
String result = pWeb->EvaluateJavascriptN(L"MyJavaScriptFunc(100);");
charlie unis
The web control can load my web page successfully, but web control reports that there is an error: can't find variable:tizen. It seems that the tizen system javascript lib isn't loaded by the web control.