Mobile Development 10.11 | webMethods Mobile SuiteWeb Help | webMethods Mobile Designer Native User Interface Reference | Native User Interface (NativeUI) Objects | nUIWebView
 
nUIWebView
com.softwareag.mobile.runtime.nui.nUIWebView
Use to create a container for the nUIWebviewElement object, which is an object that allows for the display of rich web content. This object allows you to pass messages between the Java code and the JavaScript run time in the browser. For guidelines on how to approach this, see JavaScript Bridge.
Usage Notes
*The browser engines that mobile platforms use have differences in terms of how they display objects and support of JavaScript. You might need to develop platform-specific changes to support your content. Mobile Designer does not change your raw HTML content.
*Avoid invoking the Javascript alert() method from inside a nUIWebView object. For security reasons, some manufacturers configure their devices to block displaying an alert dialog that results from a call to the Javascript alert() call. As an alternative, consider one of the following:
*Pass an event back to your Java code using a class that implements nUIWebviewCallBack, which in turn can then open a nUIAlertDialog object if an alert dialog is required.
*Use other web-based elements to display the alert information directly within your web page.
*There are two properties that react slightly differently depending on the platform.
*bgcolor
The bgcolor can be set at any time under iOS, and the web page will be redrawn to react to the change. Under Android, the changes to the bgcolor will only take affect when the webview redraws in response to changes in content (i.e., when the setURL() or setHTMLText() methods are called). For both platforms, the extent to which the web content is effected by this call is dependant on the rendering engine used in the browser itself, as well as the HTML content being displayed.
*Scaling web content to fit
This property is only usable on iOS by using UIWebView as browser engine. All other platforms ignore it. The setting will only affect page contents when the content of the page is changed (i.e. via setURL() or setHTMLText()).
There is currently no support for altering bgcolor, changing the scaling of content to fit, or enabling/disabling overscrolling for Phoney.
*On iOS, you can switch from the default WKWebView engine to the deprecated UIWebView. You can set UIWebView as default browser engine for all nUIWebView and nUIWebviewElement instances by overriding the system property ios.webview. For more information about setting system properties, see Using webMethods Mobile Designer. Or you can pass this property directly into constructor as follows:
<code>
Hashtable properties = new Hashtable();
props.put("ios.webview", "UIWebview");
nUIWebView webview = new nUIWebView(properties);
</code>
Example
This code sample creates a web view with navigation to the parent menu. Details on how the example code is rendered on various platforms follow the code sample.
protected nUIViewDisplay onCreateWebView()
{
nUIWebView web_view = new nUIWebView(NUIID_WEB_VIEW);
web_view.setHeadertext("nUIWebView");
web_view.setURL("http://www.wikipedia.org/");
nUINavbuttonElement ne = new nUINavbuttonElement(NUIID_BACK_TO_START_BUTTON,
"Back",
nUINavbuttonElement.TYPE_BACK, null);
web_view.add(ne);
return web_view;
}
Platform
Platform-Specific Class and Visual Reference
Android
android.webkit.WebView
iOS
WKWebView