• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Class (WebSchemeHandlerRequest)
2
3Represents a request intercepted by the **WebSchemeHandler** object.
4
5> **NOTE**
6>
7> - 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.
8>
9> - The initial APIs of this class are supported since API version 12.
10>
11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer.
12
13## getHeader<sup>12+</sup>
14
15getHeader(): Array\<WebHeader\>
16
17Obtains the information about the resource request header.
18
19**System capability**: SystemCapability.Web.Webview.Core
20
21**Return value**
22
23| Type                        | Description        |
24| -------------------------- | ---------- |
25| Array\<[WebHeader](./arkts-apis-webview-i.md#webheader)\> | Information about the resource request header.|
26
27**Example**
28
29For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
30
31## getRequestUrl<sup>12+</sup>
32
33getRequestUrl(): string
34
35Obtains the URL of the resource request.
36
37**System capability**: SystemCapability.Web.Webview.Core
38
39**Return value**
40
41| Type    | Description           |
42| ------ | ------------- |
43| string | URL of the resource request.|
44
45**Example**
46
47For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
48
49## getRequestMethod<sup>12+</sup>
50
51getRequestMethod(): string
52
53Obtains the request method.
54
55**System capability**: SystemCapability.Web.Webview.Core
56
57**Return value**
58
59| Type    | Description           |
60| ------ | ------------- |
61| string | Request method.|
62
63**Example**
64
65For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
66
67## getReferrer<sup>12+</sup>
68
69getReferrer(): string
70
71Obtains the referrer.
72
73**System capability**: SystemCapability.Web.Webview.Core
74
75**Return value**
76
77| Type    | Description           |
78| ------ | ------------- |
79| string | Obtained referrer.|
80
81**Example**
82
83For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
84
85## isMainFrame<sup>12+</sup>
86
87isMainFrame(): boolean
88
89Checks whether the resource request is for the main frame.
90
91**System capability**: SystemCapability.Web.Webview.Core
92
93**Return value**
94
95| Type    | Description           |
96| ------ | ------------- |
97| boolean | Whether the resource request is for the main frame. If the resource request is for the main frame, **true** is returned. Otherwise, **false** is returned.|
98
99**Example**
100
101For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
102
103## hasGesture<sup>12+</sup>
104
105hasGesture(): boolean
106
107Checks whether the resource request is associated with a gesture (for example, a tap).
108
109**System capability**: SystemCapability.Web.Webview.Core
110
111**Return value**
112
113| Type    | Description           |
114| ------ | ------------- |
115| boolean | Whether the resource request is associated with a gesture (for example, a tap). If the resource request is associated with a gesture, **true** is returned. Otherwise, **false** is returned.|
116
117**Example**
118
119For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
120
121## getHttpBodyStream<sup>12+</sup>
122
123getHttpBodyStream(): WebHttpBodyStream | null
124
125Obtains the **WebHttpBodyStream** instance in this resource request.
126
127**System capability**: SystemCapability.Web.Webview.Core
128
129**Return value**
130
131| Type    | Description           |
132| ------ | ------------- |
133| [WebHttpBodyStream](./arkts-apis-webview-WebSchemeHandler.md) \| null | **WebHttpBodyStream** instance in the resource request. If there is no **WebHttpBodyStream** instance, **null** is returned.|
134
135**Example**
136
137For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
138
139## getRequestResourceType<sup>12+</sup>
140
141getRequestResourceType(): WebResourceType
142
143Obtains the resource type of this resource request.
144
145**System capability**: SystemCapability.Web.Webview.Core
146
147**Return value**
148
149| Type    | Description           |
150| ------ | ------------- |
151| [WebResourceType](./arkts-apis-webview-e.md#webresourcetype12) | Resource type of the resource request.|
152
153**Example**
154
155For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
156
157## getFrameUrl<sup>12+</sup>
158
159getFrameUrl(): string
160
161Obtains the URL of the frame that triggers this request.
162
163**System capability**: SystemCapability.Web.Webview.Core
164
165**Return value**
166
167| Type    | Description           |
168| ------ | ------------- |
169| string | URL of the frame that triggers the request.|
170
171**Example**
172
173For the complete sample code, see [onRequestStart](./arkts-apis-webview-WebSchemeHandler.md#onrequeststart12).
174