object:request()

Type Function
Object WebView
Library native.*
Return value none
Revision 2017.3111
Keywords request

Overview

Loads the specified URL (string) into the WebView. For local content, you must specify a base system directory as a search path.

Syntax

object:request( url )
object:request( url, baseDir )
url (required)

String. The URL to load. For local files, this is a path relative to baseDir.

baseDir (optional)

Constant. A base directory constant.

Gotchas

On Android, if the web view is displaying web pages from the Internet, you must add the INTERNET permission to the build.settings file. This permission is unnecessary if the web view will only be displaying local HTML files that do not access the Internet.

settings =
{
    android =
    {
        usesPermissions =
        {
            "android.permission.INTERNET",
        },
    },
}

Example

local webView = native.newWebView( 0, 0, 320, 480 )
webView:request( "http://www.coronalabs.com/" )