0
votes

Our Worklight project uses both hybrid and native screens.
Both work fine independently. Our problem pertains to Native screens calling/embedding the Worklight page.

The structure of the native screen is:

  1. Header & footer with some data and
  2. Middle section is a native WebView component

If we try to load the Worklight page in the native WebView, it fails to initialize and load the Worklight framework.

In the native WebView we use the following to call the Worklight page:

[webView loadHTMLString:@"worklight file html content" baseURL:[NSURL
URLWithString:@"Pathtoworklightwwwresoucefolder"]];

Please advise if this is possible in Worklight...

1
AFAIK you can interact with hybrid content from Native but you can not load directly the hybrid page in Native.Som
Som: Can you elaborate why one cannot load hybrid page? Technically speaking both Native and Hybrid, render the page using webview (native and cordova)Ajay
your thoughts seems correct but actually its not. A normal Android WebView loading live or static web browser pages is a different thing. But when we load a HTML via Phone gap or Worklight they load into your Activity which extends from A custom Activity class rather than the default Activity Class. Which in results a different scenarios that you expect from a Activity. Hope you got my point.Som

1 Answers

1
votes

The Worklight framework is loaded into the Worklight-generated WebView and cannot be loaded into other WebViews.
In your case - it cannot be loaded into the native WebView you've created in the native page.

The subject of the question differs from its content, but to answer that as well:
If you are trying to invoke an adapter, you can simply do that - invoke the adapter using the Worklight-provided native API (pages 15-19). Parse the response and display it in your native WebView.