目录

Module Description

The WebView module is a Web control capability module provided by the HarmonyOS ArkWeb framework, used to programmatically control the behavior of Web components on the application side. This module does not involve the display and rendering of web pages (the display capability is provided by the Web component), but focuses on the control logic during the operation of Web components, including page loading and navigation, JavaScript script execution and bidirectional message communication, cookie and storage management, download task management, network request interception and custom responses, proxy configuration, geolocation permission management, ad filtering, forward and backward cache, media playback hosting, PDF generation, and other capabilities.

When developers use Web components to display web page content, if they need to intervene, monitor, or extend web page behavior on the application side (for example, sending messages to web pages, intercepting specific Scheme requests and returning local resources, managing the download process, configuring proxies, controlling cache policies, etc.), they should implement this through the Controller and various Manager/Delegate classes provided by this module.

For the web page display capability, see component description.

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

  • The sample effect is subject to the actual device.

  • Static methods must be used on the user interface (UI) thread.

This module provides the following common functionalities for web control:

Required Permissions

ohos.permission.INTERNET, required for accessing online web pages. For details about how to apply for a permission, see Declaring Permissions.

Modules to Import

import { webview } from '@kit.ArkWeb';

System capability: SystemCapability.Web.Webview.Core