Interfaces (Others)

NOTE

  • This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.

  • The sample effect is subject to the actual device.

WebOptions

Defines web options through the APIs.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
src string | Resource No No Address of a web page resource. To access local resource files, use the $rawfile or resource protocol. To load a local resource file (in HTML or TXT format) in the sandbox outside of the application package, use file:// to specify the path of the sandbox.
src cannot be dynamically changed through a state variable (for example, @State). To change the value, call loadUrl().
controller WebController | WebviewController No No Controller that controls various behaviors of Web components, including page navigation, declaration period status, and JavaScript interaction. WebController is deprecated since API version 9. You are advised to use WebviewController instead.
renderMode12+ RenderMode No Yes Rendering mode.
RenderMode.ASYNC_RENDER (default, cannot be dynamically adjusted): The Web component is rendered asynchronously.
RenderMode.SYNC_RENDER: The Web component is rendered synchronously.
incognitoMode11+ boolean No Yes Whether to enable incognito mode. The value true means to enable incognito mode, and false means the opposite.
Default value: false.
If undefined or null is passed, the value is false.
sharedRenderProcessToken12+ string No Yes Token of the shared rendering process specified by the Web component. In multi-rendering process mode, the Web component with the same token preferentially attempts to reuse the rendering process bound to the token. The token is bound to the rendering process when the rendering process is initialized. When the rendering process is not associated with a Web component, its binding to the token is removed.
Default value: "".
emulateTouchFromMouseEvent22+ boolean No Yes Whether to convert mouse events into touch events.
Default value: false.

WebMediaOptions10+

Describes the web media options.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
resumeInterval number No Yes Validity period for automatically resuming a web audio paused by another application, in seconds. The value range is [-2147483648, 2147483647]. If resumeInterval is set to 0, the playback is not automatically resumed. If resumeInterval is set to a value greater than 0, the playback is resumed in the specified period. If resumeInterval is set to a value less than 0, the playback is resumed in an unlimited period. Due to the approximate value, the validity period may have a deviation of less than 1 second.
NOTE
After an HLS video is interrupted, the video playback is automatically resumed when the video is returned to the foreground.
audioExclusive boolean No Yes Whether the audio of multiple Web instances in an application is exclusive.
The value true indicates that the audio of multiple Web instances in an application is exclusive, and false indicates the opposite.
The default value is true.
audioSessionType20+ AudioSessionType No Yes Web audio type in the application. The default value is STREAM_USAGE_MUSIC. This parameter changes the mapping between the component audio type and the system audio type, which affects the ArkWeb audio focus policy.

ScriptItem11+

Describes the ScriptItem object registered with the Web component through the javaScriptOnDocumentStart attribute.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
script string No No JavaScript script to be registered and executed.
scriptRules Array<string> No No Matching rules for allowed sources.
1. To allow URLs from all sources, use the wildcard (*).
2. If exact match is required, specify the exact URL, for example, https://www.example.com.
3. For fuzzy match, you can use a wildcard (*) in the website URL, for example, https://*.example.com. Websites such as "x,.y.com" and " foobar.com" are not allowed.
4. If the source is an IP address, follow rule 2.
5. For protocols other than HTTP/HTTPS (custom protocols), exact match and fuzzy match are not supported, and the protocol must end with 😕/, for example, resource://.
6. If one of the preceding rules is not met in scriptRules, the scriptRules does not take effect.
urlRegexRules23+ Array<UrlRegexRule> No Yes Regular expression matching rules for allowed sources. urlRegexRules is used for matching only when scriptRules is set to [].
Model restriction: This API can be used only in the stage model.

UrlRegexRule23+

Defines the URL regular expression rule.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
secondLevelDomain string No No Exact match of the second-level domain. For example, the second-level domain name of "https://www.example.com" is example.com, and that of "https://www.example.com.cn" is example.com.cn. If the URL does not have a second-level domain name, the value is empty.
rule string No No URL regular expression. URL regular expression matching is performed only after secondLevelDomain is matched successfully.

NestedScrollOptionsExt14+

Implements a NestedScrollOptionsExt object to set up, down, left, and right nested scrolling options.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
scrollUp NestedScrollMode No Yes Nested scrolling options when the component scrolls up.
Default value: NestedScrollMode.SELF_FIRST.
scrollDown NestedScrollMode No Yes Nested scrolling options when the component scrolls down.
Default value: NestedScrollMode.SELF_FIRST.
scrollLeft NestedScrollMode No Yes Nested scrolling options when the component scrolls left.
Default value: NestedScrollMode.SELF_FIRST.
scrollRight NestedScrollMode No Yes Nested scrolling options when the component scrolls right.
Default value: NestedScrollMode.SELF_FIRST.

NativeMediaPlayerConfig12+

Represents the configuration for enabling the application to take over web page media playback.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
enable boolean No No Whether to enable the application to take over web page media playback.
The value true means to enable the application to take over web page media playback, and false means the opposite.
Default value: false.
shouldOverlay boolean No No Whether the video player's display overlays the web page content when the application takes over the web page's video player.
The value true indicates that the video player's display overlays the web page content. This means that the height of the video layer is adjusted to cover the web page content. The value false indicates that the video player's display does not overlay the web page content. This means that the video player maintains its original height and is embedded within the web page.
Default value: false.

ExpandedMenuItemOptions(deprecated)

NOTE

This API is supported from API version 12 and deprecated from API version 20. You are advised to use editMenuOptions instead. Represents the custom expanded menu item options.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
content ResourceStr No No Display content.
startIcon ResourceStr No Yes Display icon. The default value is empty, and no icon is displayed.
action (selectedText: {plainText: string}) => void No No Selected text.

AdsBlockedDetails12+

Provides detailed information about the blocked ads when ads are blocked.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page where ads are blocked.
adsBlocked Array<string> No No URLs or dompaths of the blocked ads. If multiple ads have the same URLs, duplicate elements may exist.

SelectionMenuOptionsExt13+

Represents the selection menu option extension.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
onAppear Callback<void> No Yes Callback invoked when the custom selection menu appears.
onDisappear Callback<void> No Yes Callback invoked when the custom selection menu disappears.
preview CustomBuilder No Yes Preview content style of the custom selection menu. If this parameter is not set, there is no preview content.
menuType MenuType No Yes Type of the custom selection menu.
Default value: MenuType.SELECTION_MENU
Since API version 20, MenuType.PREVIEW_MENU supports hyperlink preview.
previewMenuOptions20+ PreviewMenuOptions No Yes Custom preview menu options.
onMenuShow21+ Callback<void> No Yes Callback invoked when the custom context menu on selection is shown.
onMenuHide21+ Callback<void> No Yes Callback invoked when the custom context menu on selection is hidden.

PreviewMenuOptions20+

Represents the options of the preview menu.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
hapticFeedbackMode HapticFeedbackMode No Yes Vibration effect when the menu is displayed. The ohos.permission.VIBRATE permission is required.
Default value: HapticFeedbackMode.DISABLED, indicating no vibration when the menu is displayed.

EmbedOptions16+

Represents the same-layer rendering configuration of the Web component.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
supportDefaultIntrinsicSize boolean No Yes Whether a same-layer rendering element supports the fixed size of 300 × 150.
When the size of an element is set using CSS on the HTML5 side, the size of the same-layer rendering element uses the CSS size. Otherwise, the size is fixed.
If the value is true, the fixed size is 300 × 150.
If the value is false and the CSS size is not set on the HTML5 side, the same-layer rendering elements are not rendered.
Default value: false.
Unit: px.
supportCssDisplayChange20+ boolean No Yes Whether the same-layer rendering visibility API supports the display attribute.
By default, the visibility status of same-layer tags relative to the viewport is supported.
If this attribute is set to true, CSS attributes can be displayed, including visibility, display, width, and height.
Otherwise, CSS attributes are not displayed, and only same-layer tags are visible relative to the viewport.

OnAlertEvent12+

Defines the callback used when a web page triggers alert().

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the web page where the dialog box is displayed.
message string No No Information displayed in the dialog box.
result JsResult No No User operation result that is notified to the Web component.

OnBeforeUnloadEvent12+

Represents the callback invoked when this page is about to exit after the user refreshes or closes the page.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the web page where the dialog box is displayed.
message string No No Message displayed in the dialog box.
result JsResult No No User operation.
isReload20+ boolean No Yes Whether the page is refreshed.
The value true indicates that the page is about to leave due to refreshing, and false indicates that the page is about to leave due to closing.
Default value: false.

OnConfirmEvent12+

Defines the callback used when a web page triggers confirm().

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the web page where the dialog box is displayed.
message string No No Information displayed in the dialog box.
result JsResult No No User operation result that is notified to the Web component.

OnPromptEvent12+

Defines the callback used when a web page triggers prompt().

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the web page where the dialog box is displayed.
message string No No Information displayed in the dialog box.
value string No No Default information returned by the dialog box.
result JsResult No No User operation result that is notified to the Web component.

OnConsoleEvent12+

Represents the callback invoked to notify the host application of a JavaScript console message.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
message ConsoleMessage No No Console message.

OnErrorReceiveEvent12+

Represents the callback triggered when an error occurs during web page loading.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
request WebResourceRequest No No Encapsulation of a web page request.
error WebResourceError No No Encapsulation of a web page resource loading error.

OnHttpErrorReceiveEvent12+

Represents the callback triggered when an HTTP error occurs during web page resource loading.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
request WebResourceRequest No No Encapsulation of a web page request.
response WebResourceResponse No No Encapsulation of a resource response.

OnDownloadStartEvent12+

Represents the callback invoked when the host application starts downloading a file.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL for the download task.
userAgent string No No User agent used for download.
contentDisposition string No No Content-Disposition response header returned by the server, which may be empty.
mimetype string No No MIME type of the content returned by the server.
contentLength number No No Length of the content returned by the server.

OnRefreshAccessedHistoryEvent12+

Defines the callback triggered when the navigation is complete.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL to be accessed.
isRefreshed boolean No No Whether the page is reloaded. The value true means that the page is reloaded by invoking the refresh9+ API, and false means the opposite.
isMainFrame22+ boolean No Yes Whether the event is triggered by the main frame.
The value true indicates that the event is triggered by the main frame, and false indicates the opposite.

OnRenderExitedEvent12+

Represents the callback invoked when the rendering process exits.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
renderExitReason RenderExitReason No No Cause for the abnormal exit of the rendering process.

OnShowFileSelectorEvent12+

Represents the callback invoked to notify the file selector result.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
result FileSelectorResult No No File selection result to be sent to the Web component.
fileSelector FileSelectorParam No No Information about the file selector.

OnResourceLoadEvent12+

Represents the callback invoked when the URL is loaded.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the loaded resource file.

OnScaleChangeEvent12+

Represents the callback invoked when the display scale of this page changes.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
oldScale number No No Display scale of the page before the change.
newScale number No No Display scale of the page after the change.

OnHttpAuthRequestEvent12+

Represents the callback invoked when an HTTP authentication request is received.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler HttpAuthHandler No No User operation.
host string No No Host to which the HTTP authentication credential is applied.
realm string No No Realm to which the HTTP authentication credential is applied.

OnInterceptRequestEvent12+

Represents the callback invoked when the Web component is about to load a URL.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
request WebResourceRequest No No Information about the URL request.

OnPermissionRequestEvent12+

Represents the callback invoked when a permission request is received.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
request PermissionRequest No No User operation.

OnScreenCaptureRequestEvent12+

Represents the callback invoked when a screen capture request is received.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler ScreenCaptureHandler No No User operation.

OnContextMenuShowEvent12+

Represents the callback invoked during a call to allow for the display of a custom context menu.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
param WebContextMenuParam No No Parameters related to the context menu.
result WebContextMenuResult No No Result of the context menu.

OnSearchResultReceiveEvent12+

Represents the callback invoked to notify the caller of the search result on the web page.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
activeMatchOrdinal number No No Sequence number of the current match, which starts from 0.
numberOfMatches number No No Total number of matches.
isDoneCounting boolean No No Whether the search operation on the current page is complete.
The value true indicates that the search operation on the current page is complete, and false indicates the opposite.
This API may be called multiple times until isDoneCounting is true.

OnScrollEvent12+

Represents the callback invoked when the scrollbar scrolls to a specified position.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
xOffset number No No Position of the scrollbar on the x-axis relative to the leftmost of the web page.
Unit: vp.
yOffset number No No Position of the scrollbar on the y-axis relative to the top of the web page.
Unit: vp.

OnSslErrorEventReceiveEvent12+

Represents the callback invoked when the web page receives an SSL error.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler SslErrorHandler No No User operation.
error SslError No No Error code.
certChainData15+ Array<Uint8Array> No Yes Certificate chain data.

SslErrorEvent12+

Provides details about the callback invoked when an SSL error occurs during resource loading.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler SslErrorHandler No No User operation.
error SslError No No Error code.
url string No No URL.
originalUrl string No No Original URL of the request.
referrer string No No Referrer URL.
isFatalError boolean No No Whether the error is a fatal error.
The value true indicates a fatal error, and false indicates a non-fatal error.
isMainFrame boolean No No Whether the resource is a main resource.
The value true indicates a main resource, and false indicates a non-main resource.
certChainData20+ Array<Uint8Array> No Yes Certificate chain data.

OnClientAuthenticationEvent12+

Represents the callback invoked when an SSL client certificate is required from the user.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler ClientAuthenticationHandler No No User operation.
host string No No Host name of the server that requests a certificate.
port number No No Port number of the server that requests a certificate.
keyTypes Array<string> No No Acceptable asymmetric private key types.
issuers Array<string> No No Issuer of the certificate that matches the private key.

VerifyPinEvent22+

Defines the callback triggered to notify the user of PIN verification.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler VerifyPinHandler No No User operation.
identity string No No Certificate credential ID used for verification.

OnWindowNewEvent12+

Represents the callback invoked when the web page requests the user to create a window.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
isAlert boolean No No Whether to open the target URL in a new window. The value true means to open the target URL in a new window, and false means to open the target URL in a new tab.
isUserTrigger boolean No No Whether the creation is triggered by the user. The value true means that the creation is triggered by the user, and false means the opposite.
targetUrl string No No Target URL.
handler ControllerHandler No No WebviewController instance for setting the new window.

WindowFeatures23+

Represents the feature information of the new window requested to be created by the web page, including the size and location.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
x number No No X coordinate of the top-left corner of the new window, in pixels.
y number No No Y coordinate of the top-left corner of the new window, in pixels.
width number No No Width of the new window, in pixels.
height number No No Height of the new window, in pixels.

OnWindowNewExtEvent23+

Defines the callback invoked when the web page requests the user to create a window.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
isAlert boolean No No The value true indicates that a dialog box is requested to be created, and the value false indicates that a new tab page is requested to be created.
isUserTrigger boolean No No Whether the creation is triggered by the user. The value true means that the creation is triggered by the user, and false means the opposite.
targetUrl string No No URL to be opened in the new window.
handler ControllerHandler No No WebviewController instance for setting the new window.
windowFeatures WindowFeatures No No Feature information of the new window requested to be created by the web page.
navigationPolicy NavigationPolicy No No Window opening mode when the web page requests a user to create a new window.

OnTouchIconUrlReceivedEvent12+

Represents the callback invoked when an apple-touch-icon URL is received.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No Received apple-touch-icon URL.
precomposed boolean No No Whether the apple-touch-icon is precomposed.
true indicates that the apple-touch-icon is precomposed, and false indicates the opposite.

OnFaviconReceivedEvent12+

Represents the callback invoked when this web page receives a new favicon.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
favicon PixelMap No No PixelMap object of the received favicon.

OnPageVisibleEvent12+

Represents the callback invoked when the old page is not displayed and the new page is about to be visible.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the new page that is able to be visible when the old page is not displayed.

OnDataResubmittedEvent12+

Represents the callback invoked when the web form data can be resubmitted.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler DataResubmissionHandler No No Handler for resubmitting web form data.

OnAudioStateChangedEvent12+

Represents the callback invoked when the audio playback status on the web page changes.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
playing boolean No No Audio playback status on the current page. The value true means that audio is being played, and false means the opposite.

OnFirstContentfulPaintEvent12+

Represents the callback invoked when the first content paint occurs on the web page.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
navigationStartTick number No No Navigation start time, in microseconds.
firstContentfulPaintMs number No No Time between navigation and when the content is first rendered, in milliseconds.

OnLoadInterceptEvent12+

Represents the callback invoked when the Web component is about to access a URL.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
data WebResourceRequest No No Information about the URL request.

OnOverScrollEvent12+

Represents the callback invoked when the web page is overscrolled.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
xOffset number No No Horizontal overscroll offset based on the leftmost edge of the web page.
Unit: vp.
yOffset number No No Vertical overscroll offset based on the top edge of the web page.
Unit: vp.

JavaScriptProxy12+

Represents the JavaScript object to be injected.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
object object No No Object to be registered. Methods can be declared, but attributes cannot.
name string No No Name of the object to be registered, which is the same as that invoked in the window.
methodList Array<string> No No Synchronous methods of the JavaScript object to be registered at the application side.
controller WebController | WebviewController9+ No No Controller. This API is deprecated since API version 9. You are advised to use WebviewController instead.
asyncMethodList12+ Array<string> No Yes Asynchronous methods of the JavaScript object to be registered at the application side. Asynchronous methods cannot obtain return values.
permission12+ string No Yes JSON string, which is empty by default. This string is used to configure JSBridge permission control and define the URL trustlist at the object and method levels.
The permission parameter of JavaScriptProxy supports the resource, HTTP, and HTTPS protocols, but does not support the file protocol.
For the example, see Invoking Application Functions on the Frontend Page.

OnPageEndEvent12+

Represents the callback invoked when the web page loading ends.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page.

OnPageBeginEvent12+

Represents the callback invoked when the web page loading begins.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page.

OnProgressChangeEvent12+

Represents the callback invoked when the web page loading progress changes.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
newProgress number No No New loading progress. The value is an integer ranging from 0 to 100.

OnTitleReceiveEvent12+

Represents the callback invoked when the document title of the web page is changed.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
title string No No Document title.
isRealTitle20+ boolean No Yes Whether the document title is a real title. The value true indicates that the title is from the title tag of the web page, and false indicates that the title is automatically generated based on the URL.
Default value: false.

OnGeolocationShowEvent12+

Represents the callback invoked when a request to obtain the geolocation information is received.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
origin string No No Index of the origin.
geolocation JsGeolocation No No User operation.

NativeEmbedVisibilityInfo12+

Provides visibility information about the same-layer tag.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
visibility boolean No No Whether the same-layer tag is visible.
The value true indicates that the same-layer tag is visible, and false indicates the opposite.
embedId string No No ID of the same-layer rendered tag.

RenderProcessNotRespondingData12+

Provides detailed information about the unresponsive rendering process.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
jsStack string No No JavaScript call stack information of the web page.
pid number No No Process ID of the web page.
reason RenderProcessNotRespondingReason No No Reason why the rendering process does not respond.

FullScreenEnterEvent12+

Provides details about the event that the Web component to enter the full-screen mode.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
handler FullScreenExitHandler No No Function handle for exiting full screen mode.
videoWidth number No Yes Video width, in px. If the element that enters fulls screen mode is a <video> element, the value represents its width; if the element that enters fulls screen mode contains a <video> element, the value represents the width of the first sub-video element; in other cases, the value is 0.
videoHeight number No Yes Video height, in px. If the element that enters fulls screen mode is a <video> element, the value represents its height; if the element that enters fulls screen mode contains a <video> element, the value represents the height of the first sub-video element; in other cases, the value is 0.

LoadCommittedDetails11+

Provides detailed information about the web page that has been submitted for redirection.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
isMainFrame boolean No No Whether the document is the main document.
The value true indicates that the document is the main document, and false indicates the opposite.
isSameDocument boolean No No Whether to navigate without changing the document.
The value true means to navigate without changing the document, and false means the opposite.
Example of navigation in the same document: 1. navigation shown in the example; 2. navigation triggered by pushState or replaceState; 3. navigation to a history entry on the same page.
didReplaceEntry boolean No No Whether the submitted new entry replaces the existing entry.
The value true indicates that the submitted new entry replaces the existing entry, and false indicates the opposite.
In certain scenarios for navigation to a subdocument, although the existing entry is not replaced, some attributes are changed.
navigationType WebNavigationType No No Navigation type.
url string No No URL of the current navigated-to web page.

NativeEmbedInfo11+

Provides detailed information about the same-layer tag.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
id string No Yes ID of the same-layer tag.
type string No Yes Type of the same-layer tag. The value is in lowercase.
src string No Yes src information of the same-layer tag.
width number No Yes Width of the same-layer tag, in px.
height number No Yes Height of the same-layer tag, in px.
url string No Yes URL of the same-layer tag.
tag12+ string No Yes Tag name, which is in uppercase.
params12+ Map<string, string> No Yes List of key-value pairs contained in the object tag that form a map of the Object type. Use the methods provided by the Object type, such as embed.info?.param?.["name"] to operate the map object.
position12+ Position No Yes Position of the same-layer tag relative to the upper left corner of the Web component as the coordinate origin, in pixels. This position is different from the standard position.

NativeEmbedParamItem21+

Provides details about the param element embedded in the same-layer rendering tag object.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
status NativeEmbedParamStatus No No Status change type of the param element.
id string No No ID of the param element.
name string No Yes Name of the param element.
value string No Yes Value of the param element.

IntelligentTrackingPreventionDetails12+

Provides detailed information about intelligent tracking prevention.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
host string No No Host name.
trackerHost string No No Host name of the tracker.

WebKeyboardCallbackInfo12+

Represents input parameters of the callback used to intercept the soft keyboard started from editable elements on a web page, including WebKeyboardController and editable element attributes.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
controller WebKeyboardController No No Controller used to control the input, deletion, and closure of the custom keyboard.
attributes Record<string, string> No No Attribute of the web page element that triggers the display of the soft keyboard.

WebKeyboardOptions12+

Represents the return value of the callback that intercepts the soft keyboard started from editable elements on the web page. You can specify the types of the keyboard, and return the value to the Web kernel to control the startup of different types of soft keyboards.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
useSystemKeyboard boolean No No Whether to use the system's default soft keyboard.
The value true means to use the system's default soft keyboard, and false means the opposite.
Default value: true.
enterKeyType number No Yes Type of the Enter key on the system soft keyboard. For details about the value range, see EnterKeyType. This parameter is optional and the default value is UNSPECIFIED. This parameter is valid only when useSystemKeyboard is set to true and enterKeyType is set to a valid value.
customKeyboard CustomBuilder No Yes Builder of a custom keyboard. This parameter is required when useSystemKeyboard is set to false. After it is set, the Web component starts the custom keyboard as configured.

FirstMeaningfulPaint12+

Provides detailed information about the first meaningful paint.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
navigationStartTime number No Yes Start time of the navigation, in microseconds.
firstMeaningfulPaintTime number No Yes Time taken for the first meaningful paint of the page, in milliseconds.

LargestContentfulPaint12+

Provides detailed information about the largest contentful paint.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
navigationStartTime number No Yes Start time of the navigation, in microseconds.
largestImagePaintTime number No Yes Loading time of the maximum image, in milliseconds.
largestTextPaintTime number No Yes Loading time of the maximum text, in milliseconds.
largestImageLoadStartTime number No Yes Start time of the loading of the maximum image, in milliseconds.
largestImageLoadEndTime number No Yes End time of the loading of the maximum image, in milliseconds.
imageBPP number No Yes Number of pixels of the maximum image.

NativeEmbedDataInfo11+

Provides detailed information about the changes of the same-layer tag lifecycle.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
status NativeEmbedStatus No Yes Lifecycle status of the same-layer tag.
surfaceId string No Yes Surface ID of the native image.
embedId string No Yes Unique ID of the same-layer tag.
info NativeEmbedInfo No Yes Detailed information about the same-layer tag.

NativeEmbedTouchInfo11+

Provides touch information of the same-layer tag.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
embedId string No Yes Unique ID of the same-layer tag.
touchEvent TouchEvent No Yes Touch action information.
result12+ EventResult No Yes Gesture event consumption result.

NativeEmbedMouseInfo20+

Provides detailed information about clicking or touching and holding a same-layer tag using the mouse or touchpad.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
embedId string No Yes Unique ID of the same-layer tag.
mouseEvent MouseEvent No Yes Information about clicking or touching and holding using the mouse or touchpad.
result EventResult No Yes Mouse event consumption result.

NativeEmbedParamDataInfo21+

Provides details about the same-layer tag when the param element embedded in the object tag changes.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
embedId string No No Unique ID of the same-layer tag.
objectAttributeId string No Yes ID of the same-layer tag.
paramItems Array<NativeEmbedParamItem> No Yes Details of the changed param element, including the status change type, ID, name, and value of each param element.

OnLoadStartedEvent20+

Represents the callback invoked when the web page loading begins.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page.

OnLoadFinishedEvent20+

Represents the callback invoked when the web page loading ends.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page.

OnPdfLoadEvent20+

Defines the function triggered when the PDF loading is successful or fails.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page.
result PdfLoadResult No No The PDF page loading result.

OnPdfScrollEvent20+

Defines the function triggered when the PDF page is scrolled to the bottom.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page.

Represents the request/response header object returned by the Web component.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
headerKey string No No Key of the request or response header.
headerValue string No No Value of the request or response header.

ScreenCaptureConfig10+

Provides the web screen capture configuration.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
captureMode WebCaptureMode No No Web screen capture mode.

BlankScreenDetectionEventInfo22+

Defines the event information when a blank screen is detected.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the page when a blank screen is detected.
blankScreenReason DetectedBlankScreenReason No No Reason for the blank screen issue, which depends on the detection method.
blankScreenDetails BlankScreenDetails No Yes Details of the blank screen issue detected.
For example, if a near-blank screen issue is detected, the details contain the number of points that match the blank screen issue. Otherwise, this attribute does not exist.

BlankScreenDetails22+

Defines details of the blank screen issue detected.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
detectedContentfulNodesCount number No Yes This attribute may exist when the contentful node detection policy is used and the threshold for the number of detected nodes is set. Otherwise, this attribute does not exist.
Number of contentful nodes that are detected.

BlankScreenDetectionConfig22+

Defines the configuration options of the blank screen detection policy.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
enable boolean No No Whether to enable the blank screen policy.
detectionTiming number[] No Yes Interval for checking whether a blank screen occurs after the loading, in seconds.

NOTE
1. Duplicate values are ignored.
2. The value must be greater than 0. Otherwise, the value is ignored.
Default value: [1.0, 3.0, 5.0].
detectionMethods BlankScreenDetectionMethod[] No Yes Methods of the detection policy. The value is an array.
NOTE
1. Duplicate values are ignored.
Default value: [BlankScreenDetectionMethod.DETECTION_CONTENTFUL_NODES_SEVENTEEN].
contentfulNodesCountThreshold number No Yes Threshold for number of detected contentful nodes. This parameter takes effect only when the contentful node detection policy is used.
The value ranges from 0 to the maximum number of nodes in the detection policy. If the value is less than or equal to the threshold, the near-blank screen is triggered.
Default value: 0.

CameraCaptureStateChangeInfo23+

Defines the state information of the camera before and after the callback is triggered.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
originalState CameraCaptureState No No Original state.
newState CameraCaptureState No No New state.

MicrophoneCaptureStateChangeInfo23+

Defines the state information of the microphone before and after the callback is triggered.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
originalState MicrophoneCaptureState No No Original state.
newState MicrophoneCaptureState No No New state.

AcceptableFileType23+

Defines the file types recommended by the web page when the file selector pulls files.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
mimeType string No No MIME type of the file.
acceptableType Array<string> No No Array of acceptable file types.

FirstScreenPaint23+

Defines the event information when the first screen paint is detected.

System capability: SystemCapability.Web.Webview.Core

Name Type Read-Only Optional Description
url string No No URL of the first screen paint statistics.
navigationStartTime number No No Time when the navigation to the page specified by url starts.
firstScreenPaintTime number No No Time when the first screen paint of the page specified url is complete.