openharmony 鸿蒙 arkts-basic-components-web-e

2026-08-25 浏览 (1)

Enums

NOTE

The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.

MessageLevel

Enumerates the information levels of the console messages.

NOTE

  • On the HTML5 side, the information level of ConsoleMessage corresponding to console.log or console.info is MessageLevel.Info.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
Debug1Debug level.
Error4Error level.
Info2Information level.
Log5Log level.
Warn3Warning level.

ConsoleMessageSource23+

Enumerates the log sources of the console messages.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
XML0Logs are generated by the XML/HTML parser of the web page, for example, HTML syntax errors, XML format exceptions, and parsing warnings caused by unclosed HTML tags.
JAVASCRIPT1Logs are generated when an exception occurs during JavaScript execution, such as a JavaScript syntax error or runtime exception.
NETWORK2Logs are generated when web page resources (such as JS, CSS, and images) fail to be loaded and error code 404 is returned.
CONSOLE_API3Logs are generated when web pages call W3C console APIs, such as console.warn and console.error.
STORAGE4Logs are generated when exceptions (such as storage quota exceeding and operation exceptions) occur on storage-related modules (LocalStorage, SessionStorage, IndexedDB and Cookie).
RENDERING5Logs are generated when exceptions (such as invalid CSS styles, layout exceptions, and rendering performance warnings) occur on the rendering engine (such as Blink).
SECURITY6Logs are generated when web page security policies are violated, HTTPS certificate errors occur, and mixed content (HTTP resources are loaded on HTTPS pages) occurs.
OTHER7Logs are generated by other sources, such as web extension plugins.
DEPRECATION8Logs are generated when an expired syntax, such as slider-vertical, is used.
WORKER9Logs are generated when service worker errors occur, for example, service worker navigation preload requests are interrupted before being completed.
VIOLATION10Logs are generated when a rule is violated, for example, the execution of a piece of JavaScript code takes more than 50 ms.
INTERVENTION11Logs are generated when the web page detects code behaviors that may compromise user experience, security, or performance. The web page proactively intervenes, blocks or modifies the behavior, and notifies you of the behavior through a message containing kIntervention. For example, the DispatchBeforeUnload event is triggered on a web page without user interaction.
RECOMMENDATION12Logs are generated when code behaviors that do not comply with web security best practices are detected and improvement suggestions are provided. For example, when the page uses APIs (such as innerHTML and eval()) that may have XSS risks and does not comply with the Trusted Types security specifications.

MixedMode

Enumerates the mixed content modes.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
All0Loose mode: HTTP and HTTPS hybrid content can be loaded. This means that all insecure content can be loaded.
Compatible1Compatible mode: HTTP and HTTPS hybrid content can be loaded in compatibility mode. This means that some insecure content may be loaded.
None2Strict mode: HTTP and HTTPS hybrid content cannot be loaded.

HitTestType(deprecated)

Enumerates the test result types of the click event.

System capability: SystemCapability.Web.Webview.Core

NOTE

This enum is supported since API version 9 and deprecated since API version 21. You are advised to use WebHitTestType instead.

NameValueDescription
EditText0Editable area.
Email1Email address.
HttpAnchor2Hyperlink whose src is http.
HttpAnchorImg3Image with a hyperlink, where src is http.
Img4HTML::img tag.
Map5Geographical address.
Phone6Phone number.
Unknown7Unknown content.

CacheMode

Enumerates the cache modes.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
Default9+0The cache that has not expired is preferentially used to load resources. If the cache is invalid or no cache is available, resources are obtained from the Internet.
None1The cache (including expired caches) is preferentially used to load resources. If no cache is available, resources are obtained from the Internet.
Online2The cache is not used to load the resources. All resources are forcibly obtained from the Internet.
Only3The local cache alone is used to load the resources.

OverScrollMode11+

Enumerates whether to enable overscroll mode.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NEVER0The overscroll mode is disabled.
ALWAYS1The overscroll mode is enabled.

BlurOnKeyboardHideMode14+

Enumerates whether the Web component loses focus when the soft keyboard is hidden.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameValueDescription
SILENT0The Web component does not lose focus when the soft keyboard is hidden.
BLUR1The Web component loses focus when the soft keyboard is hidden, and the focus moves from the text box to the web body.

WebDarkMode9+

Enumerates whether to enable web dark mode.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
Off0The web dark mode is disabled.
On1The web dark mode is enabled.
Auto2The web dark mode setting follows the system setting.

WebCaptureMode10+

Enumerates the web screen capture modes.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
HOME_SCREEN0Home screen capture mode.

ThreatType11+

Enumerates the website threat types.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
THREAT_ILLEGAL0Illegal website.
THREAT_FRAUD1Fraudulent website.
THREAT_RISK2Website that poses security risks.
THREAT_WARNING3Website suspected to contain unsafe content.
THREAT_NONE21+4Website that passes the security check and no risk is found.
THREAT_UNPROCESSED21+5Website that does not perform security check.

RenderExitReason9+

Enumerates the reasons why the rendering process exits.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
ProcessAbnormalTermination0The rendering process terminates abnormally. Possible causes include: rendering process startup timeout, system reclaiming older rendering processes upon reaching the process limit, or simultaneous closure of multiple tabs.
ProcessWasKilled1The rendering process receives a SIGKILL message or is manually terminated.
ProcessCrashed2The rendering process crashes due to segmentation or other errors.
ProcessOom3The program memory is insufficient.
ProcessExitUnknown4Other reasons, such as failure to spawn the rendering process.

SslError9+

Enumerates the error codes returned by onSslErrorEventReceive API.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
Invalid0Minor error.
HostMismatch1The host name does not match.
DateInvalid2The certificate has an invalid date.
Untrusted3The certificate issuer is not trusted.

FileSelectorMode9+

Enumerates the modes of the file selector.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
FileOpenMode0Open and upload a file.
FileOpenMultipleMode1Open and upload multiple files.
FileOpenFolderMode2Open and upload a folder.
FileSaveMode3Save a file.

WebLayoutMode11+

Enumerates the web layout modes.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NONE0The web layout follows the system.
FIT_CONTENT1The web layout adapts to the page size.

RenderProcessNotRespondingReason12+

Enumerates the reasons why the rendering process does not respond.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
INPUT_TIMEOUT0The input event response sent to the rendering process times out.
NAVIGATION_COMMIT_TIMEOUT1The navigation for loading a new web page times out.

ProtectedResourceType9+

System capability: SystemCapability.Web.Webview.Core

NameValueDescriptionAvailable Permission
MidiSysexTYPE_MIDI_SYSEXMIDI SYSEX resource.
Currently, only permission events can be reported. MIDI devices are not yet supported.
Currently, the permission related to the Musical Instrument Digital Interface (MIDI) device cannot be requested.
VIDEO_CAPTURE10+TYPE_VIDEO_CAPTUREVideo capture resource, such as a camera.Camera permission: ohos.permission.CAMERA.
AUDIO_CAPTURE10+TYPE_AUDIO_CAPTUREAudio capture resource, such as a microphone.Microphone permission: ohos.permission.MICROPHONE.
SENSOR12+TYPE_SENSORSensor resource, such as an acceleration sensor.Acceleration sensor permission: ohos.permission.ACCELEROMETER,
Gyroscope sensor permission: ohos.permission.GYROSCOPE.

ContextMenuSourceType9+

Enumerates the event source types that trigger the context menu.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
None0Other event sources.
Mouse1Mouse event.
LongPress2Long press event.

ContextMenuMediaType9+

Enumerates the media types that trigger the context menu.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
None0Other non-image media types.
Image1Image.

ContextMenuDataMediaType22+

Enumerates the media types that trigger the context menu (enhanced type obtaining capability).

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NONE0Default value, indicating that the current context menu is not associated with any media type (for example, right-click text or blank area).
IMAGE1Image.
VIDEO2Video.
AUDIO3Audio.
CANVAS4Canvas.

ContextMenuInputFieldType9+

Enumerates the input field types.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
None0Non-input field.
PlainText1Plain text field, such as the text, search, or email field.
Password2Password field.
Number3Number field.
Telephone4Phone number field.
Other5Field of any other type.

NativeEmbedStatus11+

Enumerates the lifecycles of the same-layer tag. When a same-layer tag exists on the loaded page, CREATE is triggered. When a same-layer tag is moved or is enlarged, UPDATE is triggered. When the page exits, DESTROY is triggered.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
CREATE0The same-layer tag is created.
UPDATE1The same-layer tag is updated.
DESTROY2The same-layer tag is destroyed.
ENTER_BFCACHE12+3The same-layer tag enters BFCache.
LEAVE_BFCACHE12+4The same-layer tag leaves BFCache.

NativeEmbedParamStatus21+

Enumerates the status change types of the param element embedded in the same-layer rendering tag object. ADD is triggered when the param element is added, UPDATE is triggered when it is modified, and DELETE is triggered when it is deleted.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
ADD0Triggered when a param element is added.
UPDATE1Triggered when a param element is modified.
DELETE2Triggered when a param element is deleted.

ContextMenuEditStateFlags9+

Enumerates the context menu edit state flags. This enum can be used in bitwise OR mode. For example, to support CAN_CUT, CAN_COPY, and CAN_SELECT_ALL at the same time, use CAN_CUT|CAN_COPY|CAN_SELECT_ALL or 11.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NONE0Editing is not allowed.
CAN_CUT1 << 0Cutting is supported.
CAN_COPY1 << 1Copying is supported.
CAN_PASTE1 << 2Pasting is supported.
CAN_SELECT_ALL1 << 3Selecting all is supported.

WebNavigationType11+

Enumerates the navigation types.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
UNKNOWN0Unknown type.
MAIN_FRAME_NEW_ENTRY1Navigation to a new history entry from the main document.
MAIN_FRAME_EXISTING_ENTRY2Navigation to an existing history entry from the main document.
NAVIGATION_TYPE_NEW_SUBFRAME4User-triggered navigation from a subdocument.
NAVIGATION_TYPE_AUTO_SUBFRAME5Non-user-triggered navigation from a subdocument.

RenderMode12+

Enumerates the rendering modes of the Web component. By default, the asynchronous rendering mode is used.

The asynchronous rendering mode is recommended because it has better performance and lower power consumption.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
ASYNC_RENDER0The Web component as a graphic surface node is rendered asynchronously and displayed independently. The maximum width of the Web component is 7,680 px (physical pixel).
SYNC_RENDER1The Web component as a graphic canvas node is rendered synchronously and displayed together with the system component. The maximum width of the Web component is 500,000 px (physical pixel).

ViewportFit12+

Enumerates the viewport types available for viewport-fit in the web page <meta> tag.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
AUTO0The entire web page is visible. Default value.
CONTAINS1The initial layout viewport and the visual viewport fit within the largest rectangle that adapts to the device's display screen.
COVER2The initial layout viewport and the visual viewport are confined within the bounding rectangle of the device's physical screen.

WebKeyboardAvoidMode12+

Enumerates the soft keyboard avoidance modes.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
RESIZE_VISUAL0For soft keyboard avoidance, the visual viewport is resized, but not the layout viewport.
RESIZE_CONTENT1For soft keyboard avoidance, both the visual viewport and layout viewport are resized. Default value.
OVERLAYS_CONTENT2No viewport is resized, and soft keyboard avoidance is not triggered.
RETURN_TO_UICONTEXT22+3The soft keyboard avoidance behavior of the Web component follows the KeyboardAvoidMode set by UIcontext. The Web component does not process the avoidance behavior of the component.

WebElementType13+

Enumerates the web element types.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameValueDescription
IMAGE1Image.
LINK20+2Hyperlink.
TEXT21+3Text or editable area.

WebResponseType13+

Enumerates the response types of the menu.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameValueDescription
LONG_PRESS1The menu is displayed when the component is long-pressed.
RIGHT_CLICK21+2The menu is displayed when the component is right-clicked.

AudioSessionType20+

Enumerates the web audio types in the application.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameValueDescription
AMBIENT3Web game sounds and system music can be played at the same time. This value is applicable to web game scenarios. Its corresponding system audio stream type is STREAM_USAGE_GAME.

GestureFocusMode20+

Enumerates the focus modes.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
DEFAULT0The Web component applies for the focus when it is touched, long-pressed, swiped, or zoomed.
GESTURE_TAP_AND_LONG_PRESS1The Web component applies for the focus only when it is touched and long-pressed. The swipe and zoom gestures do not apply for the focus.

WebRotateEffect22+

Enumerates the modes in which the component's content is rendered to fit the new size during its width and height animation process when the component is rotated.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
TOPLEFT_EFFECT0The component's content stays at the final size and always aligned with the upper left corner of the component. This value is used by default.
RESIZE_COVER_EFFECT1While maintaining its aspect ratio in the final state, the component's content is scaled to cover the component's entire content box. It is always aligned with the center of the component, so that its middle part is displayed.

WebBypassVsyncCondition20+

Enumerates whether to allow the rendering process to bypass the vsync scheduling.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NONE0The rendering process does not bypass the vsync scheduling. Default value.
SCROLLBY_FROM_ZERO_OFFSET1When scrollBy is used (only the scrolling offset is supported) and the scrolling offset of the web page is 0, the rendering process bypasses the vsync scheduling.

PdfLoadResult20+

Enumerates the PDF page loading results.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
LOAD_SUCCESS0The PDF file is successfully loaded.
PARSE_ERROR_FILE1The PDF file fails to be loaded.
PARSE_ERROR_FORMAT2The PDF file format is not supported.
PARSE_ERROR_PASSWORD3The PDF file password is incorrect.
PARSE_ERROR_HANDLER4The PDF file fails to be processed.

DetectedBlankScreenReason22+

Enumerates the reasons for the blank screen.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NO_CONTENTFUL_NODES0No contentful node is detected.
This may be triggered when the detection policy is DETECTION_CONTENTFUL_NODES_SEVENTEEN.
SUB_THRESHOLD_CONTENTFUL_NODES1The number of contentful nodes detected is less than or equal to the threshold.
This may be triggered when the detection policy is DETECTION_CONTENTFUL_NODES_SEVENTEEN and contentfulNodesCountThreshold is set.

BlankScreenDetectionMethod22+

Enumerates the methods for the blank screen detection.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
DETECTION_CONTENTFUL_NODES_SEVENTEEN0The page is detected using the 17-point detection method. When a rendered and contentful node is detected by a detection point, it is considered that the detection point is hit. A contentful node refers to an image, video, or text node.
If no contentful node is detected or the number of contentful nodes is less than the threshold, a blank or near-blank screen is displayed.
The 17 detection points are as follows:
Center point (1): The center point is at the geometric center of the page.
Internal grid intersection points (16): A 5 × 5 uniform grid is defined in the page area. The 16 points are the intersection points of four vertical equal division lines and four horizontal equal division lines in the page.

CredentialType22+

Enumerates the credential types.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
CREDENTIAL_USER2User credential.
CREDENTIAL_APP3Application credential.
CREDENTIAL_UKEY4UKey credential.

PinVerifyResult22+

Enumerates the PIN verification results.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
PIN_VERIFICATION_SUCCESS0Verification successful.
PIN_VERIFICATION_FAILED1Verification failed.

CameraCaptureState23+

Enumerates the camera capture states.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NONE0The camera is not working.
PAUSED1The camera is paused.
ACTIVE2The camera is active.

MicrophoneCaptureState23+

Enumerates the microphone capture states.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NONE0The microphone is not working.
PAUSED1The microphone is paused.
ACTIVE2The microphone is active.

NavigationPolicy23+

Enumerates the modes of opening a new window in the WebView.

System capability: SystemCapability.Web.Webview.Core

NameValueDescription
NEW_POPUP0Open in a new pop-up window.
NEW_WINDOW1Open in a new window.
NEW_BACKGROUND_TAB2Open in a new tab in background.
NEW_FOREGROUND_TAB3Open in a new tab in foreground.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-webview-WebviewController

openharmony 鸿蒙 arkts-apis-webview-t

openharmony 鸿蒙 arkts-apis-webview

openharmony 鸿蒙 capi-arkweb-type-h

openharmony 鸿蒙 arkts-basic-components-web-FullScreenExitHandler

openharmony 鸿蒙 arkts-apis-webview-WebDownloadManager

openharmony 鸿蒙 arkts-basic-components-web-VerifyPinHandler

openharmony 鸿蒙 capi-web-arkweb-webmessage8h

openharmony 鸿蒙 arkts-apis-webview-NativeMediaPlayerHandler

openharmony 鸿蒙 capi-web-arkweb-proxymethodwithresult

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/iJScTIl7