A JavaScript abstraction of the underlying WebKit WebView.
Members
-
active
-
Whether the current WebView is active. A value oftrueindicates that the WebView is active,falseindicates otherwise. -
allowAllPropertyChangedEvents
-
Indicates whether property change events are enabled in the WebView. A value oftrueindicates that property change events are enabled in the WebView,falseindicates otherwise. -
allowAllWebEvents
-
Indicates whether web events are enabled in the WebView. A value oftrueindicates that web events are enabled in the WebView,falseindicates otherwise. -
allowQnxObject
-
Indicates whether the WebView can access QNX objects, such as Persistent Publish/Subscribe (PPS) objects. A value oftrueindicates that QNX objects can be accessed,falseindicates otherwise. -
allowsAnyPropertyChangedEvents
-
(Read-only) Indicates whether any events are sent for any property changes in the WebView. A value oftrueindicates that events are sent when a property changes in the WebView,falseindicates otherwise. -
allowsAnyWebEvents
-
(Read-only) Indicates whether the WebView is allowed to send webevents. -
autoDeferNetworkingAndJavaScript
-
Indicates whether a WebView can retrieve a network connection or JavaScript when the app is in the foreground. A value oftrueindicates that retrieval is deferred until the application is in the foreground,falseindicates otherwise. -
backgroundColor
-
The background color of the WebView. -
consoleLogEnabled
-
Whether the console logs are enabled for the WebView. A value oftrueindicates that logs are available for the WebView,falseindicates otherwise. -
currentContext
-
(Read-only) A JSON-formatted string with the current context (i.e., alt, src, etc.) of the WebView. -
defaultFontSize
-
The font size of the WebView as a numeric value that's used as default on the WebView. -
devicePixelRatio
-
The device pixel ratio of the WebView. -
enableCrossSiteXHR
-
Indicates whether to allow cross-domain XHR long-polling or XHR streaming. A value oftrueindicates that the cross-domain XHR is enabled,falseindicates otherwise. -
enableDialogRequestedEvents
-
Indicates whether events requested by a dialog window in the WebView are enabled. A value oftrueindicates that events can be requested by a dialog window in the WebView,falseindicates otherwise. -
enableInProcessWebInspector
-
Indicates whether the in-process Web Inspector is enabled for the WebView. A value oftrueindicates that the in-process Web Inspector is enabled,falseindicates otherwise. -
enableJavaScript
-
Indicates whether JavaScript is enabled for the WebView. A value oftrueindicates that JavaScript is enabled,falseindicates otherwise. -
enableWebInspector
-
Indicates whether Web Inspector is enabled for the WebView. A value oftrueindicates that the Web Inspector is enabled,falseindicates otherwise. -
extraHttpHeaders
-
Extra HTTP header information as JSON-formatted data. You can use this property to allow a WebView to set a JSON-formatted key value list of headers, and retrieve a JSON key-value pair. The value you set or retrieve with this property is a JSON-formatted string. -
fullScreenVideoCapable
-
Indicates whether full-screen video playback is available. A value oftrueindicates that full-screen playback is enabled,falseindicates that it's disabled. -
id
-
(Read-only) The ID of the WebView. -
javaScriptInterruptTimeout
-
The number of milliseconds before an interrupt timeout occurs for JavaScript in the WebView. -
jsScreenWindowHandle
-
(Read-only) The unique identifier for the WebView application screen. -
keyboardVisible
-
Indicates whether the keyboard is enabled for the WebView. A value oftrueindicates that the keyboard is enabled,falseindicates otherwise. -
(inner, readonly) originalLocation
-
(Read-only) The original URL for the current WebView. -
overScrollColor
-
Indicates whether it's allowed to scroll past the boundaries in the WebView. A value oftrueindicates that the overscrolling is allowed,falseindicates that overscrolling isn't allowed. -
pluginsEnabled
-
Whether plugins are enabled for the WebView. A value oftrueindicates that the plugins are enabled for the WebView,falseindicates otherwise. -
processId
-
(Read-only) The process id of the WebView. -
sensitivity
-
The sensitivity mode of the WebView. Can be one of the following string values:- SensitivityAlways
- SensitivityTest
- SensitivityNoFocus
- SensitivityNever
- SensitivityFullscreen
-
setFileSystemSandbox
-
Indicates whether the filesystem sandbox is enabled for the WebView. A value oftrueindicates that the filesystem sandbox is enabled,falseindicates otherwise. -
status
-
(Read-only) The status of the WebView. -
title
-
(Read-only) The title of the WebView. -
uiWebView
-
The UI WebView of the current WebView. -
url
-
The fully qualified URL currently loaded in the WebView. -
userAgent
-
The user-agent string of the WebView. -
visible
-
The current visibility of the WebView. A value oftrueindicates that the WebView is visible on the screen,falseindicates otherwise. -
windowGroup
-
(Read-only) The windowGroup that the WebView belongs to. -
zOrder
-
The z-order of the WebView in comparison to other WebViews. Z-order indicates the order in which two-dimensional objects overlap with each other.
Methods
-
addKnownSSLCertificate(url, certificateInfo)
-
Allows the WebView to add a known SSL Certificate to its stored list of known certificates. This allows WebViews to remember certificate exceptions.Parameters:
Name Type Description urlString The url of the website for which we wish to add a known certificate. certificateInfoString The certificate info passed from the SSLHandshakingFailed event. -
addMultipleSSLCertificates(urlInfo)
-
Allows the WebView to add known SSL Certificates to its stored list of known certificates. This function also allows WebViews to retain certificate exceptions.Parameters:
Name Type Description urlInfoArray The array of URL and SSL Certificate information. The information is specified as JSON objects you want to add. Example
{String} url, {JSON String} certInfo webview.addMultipleSSLCertificates([(url, certInfo),..]) -
addOriginAccessWhitelistEntry(sourceOrigin, destination, allowSubdomainsopt)
-
Allows the WebView to add a whitelist to facilitate access between two origins. This function allows cross-origin communication that isn't otherwise possible.Parameters:
Name Type Attributes Default Description sourceOriginString The URI of the source where a network request is created. Use local://for local access.destinationString The URI of the destination of a network request. allowSubdomainsBoolean <optional>
False Specifies whether access between subdomains between source and destination origins are allowed. A value of trueindicates that access between subdomains between different origins is allowed. -
allowGeolocation(origin)
-
Allows the WebView to access geolocation information for a specific site. This function suppresses any notifications from the WebKit.Parameters:
Name Type Description originString The domain of the website that allows access to the geolocation. -
allowNotifications(origin)
-
Allows the WebView to post notifications. This function suppresses any notifications from WebKit.Parameters:
Name Type Description originString The domain of the website. -
allowUserMedia(evtId, cameraName)
-
Allow the WebView to access user media from the specified camera.Parameters:
Name Type Description evtIdNumber The ID of the event. cameraNameString The camera to be used for capturing/recording. -
allowWebEvent(eventName)
-
Allows web events, which requires explicit enabling.Parameters:
Name Type Description eventNameString The name of the event. -
allowWebInspection()
-
Indicates whether the Web Inspector is enabled for the WebView. A value oftrueindicates that the Web Inspector is enabled,falseindicates that the Web Inspector is disabled. -
animateWindowLocation(curve, duration, startX, startY, endX, endY, callback)
-
Animates the window's specified position.Parameters:
Name Type Description curveString The type of curve. It can be of the following values: - Linear
- EaseInCurve
- EaseOutCurve
durationFloat The timeframe of the animation (fractional seconds). startXInteger The starting horizontal position. startYInteger The starting vertical position. endXInteger The ending horizontal position. endYInteger The ending vertical position. callbackObject The function to call when the animation completes. -
captureContents(evtId, contentsRect, destinationSize, callback)
-
Capture a certain amount of content in the specified rectangle area of the WebView.Parameters:
Name Type Description evtIdNumber The event ID to capture the content for. contentsRectJSON The rectangle area of the contents used for capture. destinationSizeJSON The size of the contents you want to save. callbackcallback The callback function you want to call after the function completes. Example
function runmycallback(base64PNGImageString) { document.getElementById("something").src = 'data:image/png;base64,' + base64PNGImageString; } var contentsRect = JSON.stringify({x: 0, y: 0, width: screen.width, height: screen.height}); destinationSize = JSON.stringify({width: screen.width, height: screen.height}); webview.captureContents(contentsRect, destinationSize, runmycallback); -
chooseFileResponse(waitHandleID, pathopt)
-
Uses a waitable object for chooseFile event handler.Parameters:
Name Type Attributes Default Description waitHandleIDString The ID of the wait handle to the object. pathString <optional>
"" The encoded path to the target file. -
continueSSLHandshaking(streamId, SSLAction)
-
When a SSLHandshakingFailed event is triggered and causes the SSL handshake to pause. This call indicates how to handle the handshake.Parameters:
Name Type Description streamIdNumber The SSL stream identifier from the SSLHandshakingFailed event. SSLActionString The SSLAction can be one of these values: - SSLActionTrust - Continue with the handshake protocol and accept client certificates.
- SSLActionReject - Fail the handshake and refuse to accept the server certificates.
- SSLActionNone - Ignore the error and continue with the handshake.
-
createTouchInputSession()
-
Creates a touch input session for the capacitive keyboard. -
delete(onCompleteopt)
-
Deletes the underlying native WebView implementation.Parameters:
Name Type Attributes Description onCompletecallback <optional>
The callback to call after the function call completes. -
destroy(onCompleteopt)
-
Destroys the underlying native implementation of the WebView. To remove the WebView completely, delete it after this call.Parameters:
Name Type Attributes Description onCompletecallback <optional>
The callback to call when this function completes. -
destroyTouchInputSession()
-
Destroys the touch input session for the capacitive keyboard. -
dialogResponse(waitHandleID, okText, username, password)
-
Uses waitable object for dialog responses.Parameters:
Name Type Description waitHandleIDString The ID of waitHandlefor the dialog.okTextString The text response from the dialog. usernameString The username response from the dialog. passwordString The password response from the dialog. -
dialogResponse requestCurrentContextUpdate()
-
Request for the current context update. -
disallowGeolocation(origin)
-
Disallows the current WebView from accessing geolocation information from the specified domain.Parameters:
Name Type Description originString The domain of the website disallows geolocation access. -
disallowNotifications(origin)
-
Disallows the WebView from posting notifications for a specific site. This function also suppresses any notifications from WebKit.Parameters:
Name Type Description originString The domain of the website. -
disallowUserMedia(evtId)
-
Disallow the WebView from accessing user media from the specified camera.Parameters:
Name Type Description evtIdNumber The ID of the event. -
disallowWebEvent(eventName)
-
Disallows a web event, which has been explicitly enabled.Parameters:
Name Type Description eventNameString The name of the event. -
downloadURL(url)
-
The URL for the native implementation to download from.Parameters:
Name Type Description urlString The URL to download from. -
emit(eventType, args, sync)
-
Dispatches an event of the provided type with the given arguments to all registered listeners.Parameters:
Name Type Description eventTypeString The native event to emit. Only the following events can be emitted or the method fails silently.
The event type can be one of the following strings:- ContentRendered
- ContextMenuCancelEvent
- Created
- Destroyed
- DocumentLoadCommitted
- DocumentLoaded
- DocumentLoadFinished
- DialogRequested
- JavaScriptCallback
- JavaScriptResult
- InvokeRequestEvent
- LocationChange
- NetworkError
- PropertyActiveEvent
- PropertyBackgroundColorEvent
- PropertyCanGoBackEvent
- PropertyCanGoForwardEvent
- PropertyCertificateInfoEvent
- PropertyContentRectangleEvent
- PropertyCurrentContextEvent
- PropertyEnableWebInspectorEvent
- PropertyEncryptionInfoEvent
- PropertyFaviconEvent
- PropertyHistoryListEvent
- PropertyHistoryPositionEvent
- PropertyJavaScriptInterruptTimeoutEvent
- PropertyLoadProgressEvent
- PropertyLocationEvent
- PropertyOriginalLocationEvent
- PropertyScaleEvent
- PropertyScrollPositionEvent
- PropertySecureTypeEvent
- PropertyStatusEvent
- PropertyTitleEvent
- PropertyTooltipEvent
- PropertyVisibleEvent
- PropertyWebInspectorPortEvent
- PropertyViewportEvent
- PropertyZOrderEvent
argsArray.<Object> The array of objects to be passed to the event. syncBoolean A boolean value indicating whether the event should be synchronized. A value of trueindicates to synchronize the event,falseindicates otherwise. -
enableStringPatternMatching(eventName)
-
Enable string pattern matching.Parameters:
Name Type Description eventNameString The name of the event. -
executeJavaScript(js, inIsolatedWorldopt, onCompleteopt)
-
Executes JavaScript in the context of the WebView.Parameters:
Name Type Attributes Default Description jsString The JavaScript expression to be executed. inIsolatedWorldboolean <optional>
false Whether to run JavaScript in isolated context. A value of trueindicates to in isolated context. The default isfalse/onCompletecallback <optional>
The callback to be invoked when the destruction call is complete. -
handleContextMenuResponse(action)
-
Based on the given action, indicates to the native implementation to handle the context-menu response.Parameters:
Name Type Description actionString The identifier of the context-menu action to be handled. -
hasKnownSSLCertificate(url)
-
Allows the WebView to add a known SSL Certificate to its stored list of known certificates. This allows WebViews to remember certificate exceptions.Parameters:
Name Type Description urlString The url of the website for which we wish to add a known certificate. -
initialize(orientation)
-
Initializes the WebView with an orientation.Parameters:
Name Type Description orientationNumber The orientation you want to initialize. You can use integer values, such as 0, 90, -90, etc. -
isGeolocationAllowed(origin)
-
Determine whether the specified domain is allowed to access geolocation information. This function suppresses any notifications from WebKit.Parameters:
Name Type Description originString The domain of the website that disallows geolocation access. -
isVideoFullScreen()
-
Returns the boolean value for the property VideoFullScreen of the WebView -
isWebEventAllowed(eventName)
-
Determines if an event has been explicitly enabled.Parameters:
Name Type Description eventNameString The name of the event. -
knownSSLCertificates()
-
Shows all of the known SSL Certificates of the WebView. -
log(errorMsg)
-
Logs the error message of the WebView.Parameters:
Name Type Description errorMsgString The error message you want to log. -
notifyApplicationOrientationDone()
-
Notifies the native implementation that the WebView has completed its rotation. -
notifyContextMenuCancelled()
-
Notifies native implementation that the context menu has been dismissed. -
notifyDataReceived(streamId, responseCode, value)
-
Notifies the native implementation of WebView that data was received.Parameters:
Name Type Description streamIdNumber The identifier of the stream that has been opened. responseCodeString The response to the opening of it. valueString The value you wish to send as a notification to the native implementation of WebView. -
notifyDone(streamId, responseCode, value)
-
Notifies native implementation that everything has completed.Parameters:
Name Type Description streamIdNumber The identifier of the stream that has been opened. responseCodeString The response to the opening of it. valueString The value you wish to send as a notification to the native implementation of WebView. -
notifyHeaderReceived(streamId, responseCode, value)
-
Notifies the native implementation of WebView that a header was received.Parameters:
Name Type Description streamIdNumber The streamId of the stream that has been opened. responseCodeString The response to the opening of it. valueString The value you wish to send as a notification to the native implementation of WebView. -
notifyOpen(streamId, responseCode, value)
-
Notifies the native implementation of WebView of the code that descriptors are open.Parameters:
Name Type Description streamIdNumber The identifier of the stream that has been opened. responseCodeString The response to the opening of it. valueString The value passed to the native implementation of WebView. -
notifySystemLowMemory()
-
Notifies the native implementation that the WebView in the application is low on memory. -
on(eventType, eventListener)
-
Adds a listener for a given event. Multiple listeners can be registered for the same event.Parameters:
Name Type Description eventTypeString The native event to listen for. Only the following events can be specified or the method silently fails.
The event type can be one of the following strings:- ContentRendered
- ContextMenuCancelEvent
- Created
- Destroyed
- DocumentLoadCommitted
- DocumentLoaded
- DocumentLoadFinished
- DialogRequested
- JavaScriptCallback
- JavaScriptResult
- InvokeRequestEvent
- LocationChange
- NetworkError
- PropertyActiveEvent
- PropertyBackgroundColorEvent
- PropertyCanGoBackEvent
- PropertyCanGoForwardEvent
- PropertyCertificateInfoEvent
- PropertyContentRectangleEvent
- PropertyCurrentContextEvent
- PropertyEnableWebInspectorEvent
- PropertyEncryptionInfoEvent
- PropertyFaviconEvent
- PropertyHistoryListEvent
- PropertyHistoryPositionEvent
- PropertyJavaScriptInterruptTimeoutEvent
- PropertyLoadProgressEvent
- PropertyLocationEvent
- PropertyOriginalLocationEvent
- PropertyScaleEvent
- PropertyScrollPositionEvent
- PropertySecureTypeEvent
- PropertyStatusEvent
- PropertyTitleEvent
- PropertyTooltipEvent
- PropertyVisibleEvent
- PropertyWebInspectorPortEvent
- PropertyViewportEvent
- PropertyZOrderEvent
eventListenerObject The function to invoke when the specified event occurs. -
once(eventType, eventListener)
-
Adds a listener for an event that removes itself after a single occurrence of the specified event.Parameters:
Name Type Description eventTypeString The native event to listen for. Only the following events can be listened to or the method fails silently.
The event type can be one of the following strings:- ContentRendered
- ContextMenuCancelEvent
- Created
- Destroyed
- DocumentLoadCommitted
- DocumentLoaded
- DocumentLoadFinished
- DialogRequested
- JavaScriptCallback
- JavaScriptResult
- InvokeRequestEvent
- LocationChange
- NetworkError
- PropertyActiveEvent
- PropertyBackgroundColorEvent
- PropertyCanGoBackEvent
- PropertyCanGoForwardEvent
- PropertyCertificateInfoEvent
- PropertyContentRectangleEvent
- PropertyCurrentContextEvent
- PropertyEnableWebInspectorEvent
- PropertyEncryptionInfoEvent
- PropertyFaviconEvent
- PropertyHistoryListEvent
- PropertyHistoryPositionEvent
- PropertyJavaScriptInterruptTimeoutEvent
- PropertyLoadProgressEvent
- PropertyLocationEvent
- PropertyOriginalLocationEvent
- PropertyScaleEvent
- PropertyScrollPositionEvent
- PropertySecureTypeEvent
- PropertyStatusEvent
- PropertyTitleEvent
- PropertyTooltipEvent
- PropertyVisibleEvent
- PropertyWebInspectorPortEvent
- PropertyViewportEvent
- PropertyZOrderEvent
eventListenerObject The function to be invoked when the event is emitted. -
publishRemoteFunction(name, handler, options)
-
Publishes a name that maps to a specific function. This function allows other WebViews to request execution of the handler.Parameters:
Name Type Description nameString The name of the function to be published. handlerObject The function to publish. optionsObject Optional configuration object. The subparameters are "scope" and "once". -
reload()
-
Reloads the current WebView. -
remoteExec(webviewId, name, args, callbackopt)
-
Performs a remote function call on another WebView.Parameters:
Name Type Attributes Description webviewIdNumber The ID of the target WebView. nameString The name of the function to call. argsArray.<Object> The arguments for the target function. callbackCallback <optional>
callback that runs on completion. This parameter is ignored on synchronous calls. -
removeAllKnownSSLCertificates()
-
Removes all of the known SSL certificates. -
removeKnownSSLCertificate(url, certificateId)
-
Remove the specified SSL certificate based on a matching URL and a certificate ID.Parameters:
Name Type Description urlString The URL of the website. certificateIdString The signature of the certificate. Example
var certificate = JSON.parse(context), certificateId = certificate.connectionInfo.certificateInfo.certificates[0].signature, url = certificate.url; -
removeOriginAccessWhitelistEntry(sourceOrigin, destination, allowSubdomainsopt)
-
Allows the WebView to remove previously added whitelist entries.Parameters:
Name Type Attributes Default Description sourceOriginString The URI of the source where a network request is created. Use local://for local access.destinationString The URI of the destination of a network request. allowSubdomainsBoolean <optional>
False Specifies whether access between subdomains between source and destination origins are allowed. A value of trueindicates that access between subdomains between different origins is allowed. -
runRemoteExecCallback(callbackId, args)
-
Used as the entry point of the RPC channel to run a callback with parameters.Parameters:
Name Type Description callbackIdNumber The identifier of the callback to run. argsString A list of string parameters for the callback. -
setApplicationOrientation(angle)
-
Sets orientation of the WebView.Parameters:
Name Type Description angleNumber The angle of the orientation. -
setBackgroundColor(color)
-
Sets the background color of the WebView.Parameters:
Name Type Description colorString The desired background color of the WebView as a hex value. - Deprecated: Yes
- See:
-
- backgroundColor
Example
webview.setBackgroundColor("0x00FFFFFF"); -
setExtraPluginDirectory(directory)
-
Sets an extra plugin directory for the WebView.Parameters:
Name Type Description directoryString Path to the extra directory. For example: '/usr/lib/browser/plugins' -
setGeometry(x, y, width, height)
-
Configures the dimensions and location of the WebView on the screen.Parameters:
Name Type Description xNumber The x-position of the WebView on the screen. yNumber The y-position of the WebView on the screen. widthNumber The width of the WebView on the screen (in pixels). heightNumber The height of the WebView on the screen (in pixels). -
setPopupWebView(popupId)
-
Allow popup dialogs in the WebView.Parameters:
Name Type Description popupIdString The popup dialog's window ID. -
stop(onCompleteopt)
-
Stops the current WebView.Parameters:
Name Type Attributes Description onCompletecallback <optional>
The callback that's called when this function completes. -
syncProxyCredential(username, password)
-
Synchronizes the proxy credential of the WebView.Parameters:
Name Type Description usernameString The username of the proxy credential. passwordString The password of the proxy credential. -
un(eventType, eventListener)
-
Removes a specific registered listener for a given event.Parameters:
Name Type Description eventTypeString The native event to remove. Only the following events can be removed or the method silently fails.
The event type can be one of the following strings:- ContentRendered
- ContextMenuCancelEvent
- Created
- Destroyed
- DocumentLoadCommitted
- DocumentLoaded
- DocumentLoadFinished
- DialogRequested
- JavaScriptCallback
- JavaScriptResult
- InvokeRequestEvent
- LocationChange
- NetworkError
- PropertyActiveEvent
- PropertyBackgroundColorEvent
- PropertyCanGoBackEvent
- PropertyCanGoForwardEvent
- PropertyCertificateInfoEvent
- PropertyContentRectangleEvent
- PropertyCurrentContextEvent
- PropertyEnableWebInspectorEvent
- PropertyEncryptionInfoEvent
- PropertyFaviconEvent
- PropertyHistoryListEvent
- PropertyHistoryPositionEvent
- PropertyJavaScriptInterruptTimeoutEvent
- PropertyLoadProgressEvent
- PropertyLocationEvent
- PropertyOriginalLocationEvent
- PropertyScaleEvent
- PropertyScrollPositionEvent
- PropertySecureTypeEvent
- PropertyStatusEvent
- PropertyTitleEvent
- PropertyTooltipEvent
- PropertyVisibleEvent
- PropertyWebInspectorPortEvent
- PropertyViewportEvent
- PropertyZOrderEvent
eventListenerObject The function to be removed from the list of event listeners -
unpublishRemoteFunction(name)
-
Removes a published function name.Parameters:
Name Type Description nameString The name of the function to remove. -
WebView(options)
-
Create the WebView with specified parameters that are passed as options. The WebView is enabled with keyboard events and to use default webevent handlers. Theoptionsthat you pass specify the WebView ID, callback function name, and process ID of the WebView.options.WebViewIdspecifies the WebView ID to use.options.onCreatespecifies the WebView created callback function.options.processIdspecifies the process ID of the WebView.
Parameters:
Name Type Description optionsObject The options used for the WebView.