• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Class (PermissionRequest)
2
3Implements the **PermissionRequest** object. For details about the sample code, see [onPermissionRequest](./arkts-basic-components-web-events.md#onpermissionrequest9).
4
5> **NOTE**
6>
7> - 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.
8>
9> - The initial APIs of this class are supported since API version 9.
10>
11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer.
12
13## constructor<sup>9+</sup>
14
15constructor()
16
17Constructs a **PermissionRequest** object.
18
19**System capability**: SystemCapability.Web.Webview.Core
20
21## deny<sup>9+</sup>
22
23deny(): void
24
25Denies the permission requested by the web page.
26
27**System capability**: SystemCapability.Web.Webview.Core
28
29## getOrigin<sup>9+</sup>
30
31getOrigin(): string
32
33Obtains the origin of this web page.
34
35**System capability**: SystemCapability.Web.Webview.Core
36
37**Return value**
38
39| Type    | Description          |
40| ------ | ------------ |
41| string | Origin of the web page that requests the permission.|
42
43## getAccessibleResource<sup>9+</sup>
44
45getAccessibleResource(): Array\<string\>
46
47Obtains the list of accessible resources requested for the web page. For details about the resource types, see [ProtectedResourceType](./arkts-basic-components-web-e.md#protectedresourcetype9).
48
49**System capability**: SystemCapability.Web.Webview.Core
50
51**Return value**
52
53| Type             | Description           |
54| --------------- | ------------- |
55| Array\<string\> | List of accessible resources requested by the web page.|
56
57## grant<sup>9+</sup>
58
59grant(resources: Array\<string\>): void
60
61Grants the permission for resources requested by the web page.
62
63**System capability**: SystemCapability.Web.Webview.Core
64
65**Parameters**
66
67| Name      | Type           | Mandatory  | Description           |
68| --------- | --------------- | ---- | --------------- |
69| resources | Array\<string\> | Yes  | List of resources that can be requested by the web page with the permission to grant.|
70