WebView

Loads the HTML page and/or runs JavaScript, displays files such as text file, XML file, PDF etc. and explores the Web page.

eon_mobile_webviewex object

Properties
integer ii_errorcode

Error code which is returned when the oe_error event is triggered.

string is_errortext

Error message which is returned when the oe_error event is triggered.

Events
oe_error

Description

Occurs when there is any error in this functionality. In the Android OS, when this event is triggered, an error page from the Android OS will be displayed. However, unlike Android, iOS will not return any error page or error message box, therefore, it is recommended that you write code in this event to display an error message box or an error page which you specially prepared for the iOS device.

Supported on mobile client only.

Syntax

None.

Return value

None.

oe_jscallbackappeon

Description

Occurs automatically when the Web page loaded into the eon_mobile_webviewex object calls this JavaScript function: callbackappeon (as_data) for iOS, or eon_android.callbackappeon (as_data) for Android. So this event and the JavaScript function together can be utilized as communication bridge between the Web page and the PowerServer mobile app.

callbackappeon (as_data) is a JavaScript function predefined in PowerServer for use in iOS only, and the eon_android JavaScript object and its callbackappeon (as_data) function are predefined in Appeon for use in Android only. Users need not to declare them before calling them; and users should prevent declaring and overloading them too. If these functions are called by a Web page that is not loaded into the eon_mobile_webviewex object, they will return errors such as "'callbackappeon' is undefined" or "'eon_android' is undefined".

Supported on mobile client only.

Syntax

oe_jscallbackappeon ( string as_data )

Argument Type

Argument

Description

string

as_data

Receives the string passed in by the parameter of the callbackappeon JavaScript function. You will need to make sure the value to be passed in is a string, not of any other data type.

Return value

None.

Code example

The following code shows how to encapsulate a callbackappeon (as_data) function and then call it instead of calling the callbackappeon (as_data) or eon_android.callbackappeon (as_data) directly.

function jscallbackappeon(as_data)
 {       
         if ( typeof(callbackappeon) == "function" )
         {                  
                   callbackappeon(as_data);
         }
         else if (typeof(eon_android) == "object" ) 
         {  
                   eon_android.callbackappeon(as_data);
         }        

}
oe_loadend

Description

Occurs when the of_startloading function finishes loading the page.

Supported on mobile client only.

Syntax

None.

Return value

None.

oe_loadstart

Description

Occurs when the of_startloading function starts loading the page.

Supported on mobile client only.

Syntax

None.

Return value

None.

Functions
of_cangoback

Description

Indicates whether the user can move backward.

Supported on mobile client only.

Syntax

webview.of_cangoback ( )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

Return value

Integer.

0 - Unable to move backward.

1 - Able to move backward.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_cangoforward

Description

Indicates whether the user can move forward.

Supported on mobile client only.

Syntax

webview.of_cangoforward ( )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

Return value

Integer.

0 - Unable to move forward.

1 - Able to move forward.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_goback

Description

Loads the previous location in the back-forward list.

Supported on mobile client only.

Syntax

webview.of_goback ( )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_goforward

Description

Loads the next location in the back-forward list.

Supported on mobile client only.

Syntax

webview.of_goforward ( )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_loadhtmlstring

Description

Loads the string of the HTML page. Only HTM or HTML file is supported.

Supported on mobile client only.

Syntax

webview.of_loadhtmlstring ( value string as_htmlstring )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

string

as_htmlstring

The string of the HTML page which you want to load.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

Code example

string ls_filepath,ls_file
integer li_ret
long ll_file

ls_file = appeongetcachedir()+"/plugin/customer.html"

ll_file = fileopen(ls_file,textmode!,read!,shared!)
filereadex(ll_file,ls_filepath)
messagebox('',ls_filepath)
li_ret = uo_webview.of_loadhtmlstring (ls_filepath)
if li_ret > -1 then 
 messagebox("note:", "success of_loadhtmlstring: Filepath:"  +ls_filepath + ", return value:" +  string(li_ret))
else
 messagebox("note:", "failed of_readBlock:: Filepath:"  +ls_filepath + ", return value:" +  string(li_ret))
end if

fileclose(ll_file)
of_loadlocalfile

Description

Loads and displays the local file.

In iOS, the following file types can be loaded and displayed: PDF, TXT, XML, Word, Excel, and PPT. Android supports fewer file types as it can only support text types such as TXT, XML, and HTML. Android does not support loading the PDF file, therefore you will not be able to load the local PDF file in Android, but if you put the PDF file on a Web site accessible via Internet, and allow the mobile device to connect with the Web site and Google Docs (docs.google.com), then PowerServer can parse the PDF file online via Google Docs (docs.google.com) and then load the PDF file into the Android device, for example, if you put the PDF file online as http://demo.appeon.com/AEM/appeon_mobile_2013R2_datasheet.pdf, then PowerServer mobile app will automatically display the online PDF file via URL http://docs.google.com/gview?embedded=true&url=http://demo.appeon.com/AEM/appeon_mobile_2013R2_datasheet.pdf.

Supported on mobile client only.

Syntax

webview.of_loadlocalfile ( value string as_filepath )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

string

as_filepath

The path of the local file which you want to load.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

Code example

int  li_ret
string ls_filepath

ls_filepath = appeongetcachedir()+"/plugin/pig.txt"
li_ret = uo_webview.of_loadlocalfile (ls_filepath)
if li_ret > -1 then 
 messagebox("note:", "success of_loadlocalfile:FilePath:" +ls_filepath + ", return value:" +  string(li_ret))
else
 messagebox("note:", "failed of_loadlocalfile:FilePath:" +ls_filepath + ", return value:" +  string(li_ret))
end if
of_reload

Description

Reloads the current page.

Supported on mobile client only.

Syntax

webview.of_reload ( )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

of_runjavascript

Description

Runs the JavaScript code snippet.

Supported on mobile client only.

Syntax

webview.of_runjavascript ( value string as_strjs, ref string as_strret )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

string

as_strjs

The script which you want to run. You can use the syntax "functionname()" to call the JavaScript methods or the methods of the current page.

string

as_strret

The result of running script.

Any value returned from JavaScript will be returned here; if there is no return value from JavaScript (like Alert, or simple script for assigning values to variables), -1 will be returned, if there is any error running JavaScript, then an empty string will be returned.

Return value

Integer.

1 - If the as_strret parameter returns a non-empty string.

-1 - If the as_strret parameter returns an empty string, or if it is called in PowerBuilder or PowerServer Web.

Code example

string  ls_strjs,ls_strret
integer li_ret
ls_strjs= 'function MyJavaScript() { var message; message = "Say Hello"; return message; } MyJavaScript();'

li_ret = uo_webview.of_runjavascript (ls_strjs,ls_strret)

if li_ret > -1 then
    mle_1.text = "success of_runjavascript:" +ls_strret+ ",return value:" +  string(li_ret)
else
    mle_1.text = "failed of_runjavascript:" +ls_strret+ ", return value:" +  string(li_ret)
end if
of_startloading

Description

Starts the loading of the page.

Supported on mobile client only.

Syntax

webview.of_startloading ( value string as_url )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

string

as_url

The URL of the page which you want to load.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.

Code example

int  li_ret
string ls_url

ls_url= "www.google.com"
li_ret = uo_webview.of_startloading(ls_url)
if li_ret > -1 then 
 messagebox("note:", "success of_startloading:URL:" + ls_url + ",return value:" +string(li_ret))
else
 messagebox("note:", "failed of_startloading:URL:" + ls_url + ",return value:" +string(li_ret))
end if
of_stoploading

Description

Stops the loading of the current page.

Supported on mobile client only.

Syntax

webview.of_stoploading ( )

Argument Type

Argument

Description

eon_mobile_webviewex

webview

The name of the eon_mobile_webviewex object.

Return value

Integer.

1 - Success.

-1 - It is called in PowerBuilder or PowerServer Web, or there is an error.