event.errorCode

Type Number
Event urlRequest
Revision Release 2024.3703
Keywords urlRequest, errorCode

Overview

An error code if a problem occurred in the URL request of a native.newWebView() or native.showWebPopup() call. Otherwise, returns nil.

A platform-specific integer for the error which is not language dependent. This property only exists when an error occurs.

Example

local function webListener( event )

    if ( event.errorCode ) then
        native.showAlert( "Error!", event.errorMessage, { "OK" } )
    end
end

local webView = native.newWebView( display.contentCenterX, display.contentCenterY, 320, 480 )
webView:request( "https://solar2d.com/" )

webView:addEventListener( "urlRequest", webListener )