Mobile Development 10.11 | webMethods Mobile SuiteWeb Help | webMethods Mobile Designer Native User Interface Reference | Native User Interface (NativeUI) Objects | nUIWebviewElement
 
nUIWebviewElement
com.softwareag.mobile.runtime.nui.nUIWebviewElement
Use to display rich web content from a local or remote source. 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 nUIWebviewElement 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. 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.
Example
This code sample displays rich web content from a website. Details on how the example code is rendered on various platforms follow the code sample.
nUIWebviewElement webelement =
new nUIWebviewElement(NUIID_MY_WEBVIEWELEMENT);
webelement.setHeight(250);
webelement.setURL("http://www.wikipedia.org/");
view.add(webelement);
Platform
Platform-Specific Class and Visual Reference
Android
android.webkit.WebView
iOS
WKWebView