Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

WebView API

Call on the WebView directly from your controller.

Refer to Rhodes Application User Interface for a general discussion of the Rhodes application user interface.

WebView does not support opening internet URLs required authentification. Use the AsyncHTTP/AsyncHTTPS API for access to URL required authentification.

refresh

Force WebView to refresh the current page.

WebView.refresh
WebView.refresh(index)
index (optional) Force the WebView to refresh the page on the tab with the specified index. If no tab bar present, index is ignored.

navigate

Force WebView to navigate to a URL.

WebView.navigate(url, index)

White page flickering during transition may happen if a controller action method doesn’t return any rendered value, but instead performs a WebView.navigate(someUrl) call. It is important to avoid using WebView.navigate in action methods because WebView.navigate is intended to be used in callback methods asynchronously.

url Navigate to this url.
index (optional) Force the WebView to navigate using the page on the tab with the specified index. If no tab bar present, index is ignored.

navigate_back

Force WebView to navigate to the previous page using Browser back.

WebView.navigate_back

current_location

Returns the url (location) of the current page; the last URL loaded to WebView by Rhodes.

f you open your page in WebView, and after it makes a few jumps by linking (for example, to outside web adresses for example), current_location will still return the initial url opened in WebView. Also, if you use QJMobile, current_location has the initial URL, but does not reflect the actual window.location containing the JQMobile additional address by adding #, etc. See get_current_url.

WebView.current_location
WebView.current_location(index)
index (optional) Return the url for the page on the tab with the specified index. If no tab bar present, index is ignored.

execute_js

Execute JavaScript on the current page from your controller. Supported on iPhone, Android, Windows Mobile and Blackberry 5.0 in full browser mode.

WebView.execute_js(string)

For most mobile platforms, WebView.execute_js has been implemented via redirection to URL with ‘javascript:’ schema. If WebView.execute_js used in an AJAX call handler method in the controller, it may lead to the situation where the success JavaScript handler will never be executed. This may happen because, at the moment of success handler should be executed, a URL of the page already has been changed. This means no handlers from the previous page are valid.

Refer to Control WebView from controller actions for an example.

string The call to the JavaScript method on the current page, such as "test();".

active_tab

Returns an index of @tab array for the currently selected tab.

WebView.active_tab

full_screen_mode

Switch to/from full screen mode.

WebView.full_screen_mode(enable)
enable 1- enable full screen mode. 0 - disable full screen mode.

set_cookie

When WebView loads the specified url (either by selecting link or from calling WebView.navigate), it will add this cookie to the HTTP request.

WebView.set_cookie(url, cookie)
url Set a cookie to be used by WebView for this url.
cookie One or more name/value pairs of the format "NAME=VALUE". Separate multiple name/value pairs with a semicolon, such as "NAME1=VALUE1; NAME2=VALUE2”.

get_current_url

Returns the actual URL in WebView. This works the same as the JavaScript window.location.href.

WebView.get_current_url()
Back to Top