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

2026-08-25 浏览 (1)

Class (WebResourceRequest)

Implements the WebResourceRequest object to obtain resource requests. For details about the sample code, see onErrorReceive.

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.

  • The initial APIs of this class are supported since API version 8.

  • The sample effect is subject to the actual device.

constructor

constructor()

Constructs a WebResourceRequest object.

System capability: SystemCapability.Web.Webview.Core

getRequestHeader

getRequestHeader(): Array<Header>

Obtains the information about the resource request header.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
Array<Header>Information about the resource request header.

getRequestUrl

getRequestUrl(): string

Obtains the URL of the resource request.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
stringURL of the resource request.

isMainFrame

isMainFrame(): boolean

Checks whether the resource request is for the main frame.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
booleanWhether the resource request is for the main frame.
The value true indicates that the resource request is for the main frame, and false indicates the opposite.

isRedirect

isRedirect(): boolean

Checks whether the resource request is redirected by the server.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
booleanWhether the resource request is redirected by the server.
The value true indicates that the resource request is redirected by the server, and false indicates the opposite.

isRequestGesture

isRequestGesture(): boolean

Checks whether the resource request is associated with a gesture (for example, a tap).

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
booleanWhether the resource request is associated with a gesture (for example, a tap).
The value true indicates that the resource request is associated with a gesture, and false indicates the opposite.

getRequestMethod9+

getRequestMethod(): string

Obtains the request method.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
stringRequest method.

你可能感兴趣的鸿蒙文章

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/1Ovdhsvn