diff --git a/en/application-dev/reference/arkui-js/js-components-basic-web.md b/en/application-dev/reference/arkui-js/js-components-basic-web.md index 403162b023a9ea4788559e5f96812ce9a5f785ea..7130a68b89c88a8e02cc9872a0eaa29d17807105 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-web.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-web.md @@ -3,6 +3,9 @@ The **\** component displays web page content. >![](../../public_sys-resources/icon-note.gif) **NOTE** > This component is supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version. +## Required Permissions +ohos.permission.INTERNET, required only for accessing online web pages. + ## Constraints The **\** component does not follow the transition animation. A page allows only one **\** component. @@ -44,7 +47,7 @@ The following methods are supported. ``` ``` - +// xxx.js export default { reloadWeb() { this.$element('web').reload() diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-web.md b/en/application-dev/reference/arkui-ts/ts-basic-components-web.md index 948ad5920d906f7437d20e9a0ffd6511e13bd7ac..b6b1c354dcd9ac2a60ddf67c93c91fbcdd7abf80 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -5,6 +5,9 @@ The **** component can be used to display web pages. +## Required Permissions +ohos.permission.INTERNET, required only for accessing online web pages. + ## Child Components None @@ -31,9 +34,9 @@ None | Name | Type | Default Value | Description | | ----------------- | ------------------------------------------------------------ | -------------- | ------------------------------------------------------------ | | domStorageAccess | boolean | false | Whether to enable the DOM Storage API permission. By default, the permission is disabled.| -| fileAccess | boolean | true | Whether to enable in-application rawfile access through [$rawfile(filepath/filename)](ts-application-resource-access.md#referencing-resources). By default, this feature is enabled. | +| fileAccess | boolean | true | Whether to enable in-application rawfile access through [$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#referencing-resources). By default, this feature is enabled.| | imageAccess | boolean | true | Whether to enable automatic image loading. By default, this feature is enabled. | -| javaScriptProxy | {
object: object,
name: string,
methodList: Array\,
controller: WebController
} | - | JavaScript object to be injected into the window. Methods of this object can be invoked in the window. The parameters in this attribute cannot be updated.
**object** indicates the object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type.
**name** indicates the name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side.
**methodList** indicates the methods of the JavaScript object to be registered at the application side.
**controller** indicates the controller. | +| javaScriptProxy | {
object: object,
name: string,
methodList: Array\,
controller: WebController
} | - | JavaScript object to be injected into the window. Methods of this object can be invoked in the window. The parameters in this attribute cannot be updated.
**object** indicates the object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type.
**name** indicates the name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side.
**methodList** indicates the methods of the JavaScript object to be registered at the application side.
**controller** indicates the controller.| | javaScriptAccess | boolean | true | Whether JavaScript scripts can be executed. By default, JavaScript scripts can be executed. | | mixedMode | [MixedMode](#MixedMode) | MixedMode.None | Whether to enable loading of HTTP and HTTPS hybrid content can be loaded. By default, this feature is disabled.| | onlineImageAccess | boolean | true | Whether to enable access to online images through HTTP and HTTPS. By default, this feature is enabled.| @@ -54,7 +57,7 @@ None Universal events are not supported. -| Name | Description | +| Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | | onAlert(callback: (event?: { url: string; message: string; result: [JsResult](#JsResult) }) => boolean) |

Triggered when **alert()** is invoked to display an alert dialog box on the web page.
If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can invoke the system dialog box capability (allows only the confirm operation) and invoke the **JsResult** API to notify the **\** component of the user's operation.
**url**: URL of the web page where the dialog box is displayed.
**message**: information displayed in the dialog box.
**JsResult**: notifies the **\** component of the user's operation.

| | onBeforeUnload(callback: (event?: { url: string; message: string; result: [JsResult](#JsResult) }) => boolean) |

Triggered when the current page is about to exit after the user refreshes or closes the page.
If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can invoke the system dialog box capability (allows the confirm and cancel operations) and invoke the **JsResult** API to notify the **\** component of the user's operation.
**url**: URL of the web page where the dialog box is displayed.
**message**: information displayed in the dialog box.
**JsResult**: notifies the **\** component of the user's operation.

| @@ -62,7 +65,7 @@ Universal events are not supported. | onConsole(callback: (event?: { message: [ConsoleMessage](#ConsoleMessage) }) => boolean) |

Triggered when the host application is notified of a JavaScript console message.
**message**: console message.

| | onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisposition: string, mimetype: string, contentLength: number }) => void) |

Triggered when a download task starts on the web page.
**url**: URL for the download task.
**userAgent**: name of the user agent (UA) for the download task.
**contentDisposition**: Content-Disposition response header returned by the server, which may be empty.
**mimetype**: content media type (MIME) returned by the server.
**contentLength**: length of the file returned by the server.

| | onErrorReceive(callback: (event?: { request: [WebResourceRequest](#WebResourceError), error: [WebResourceError](#WebResourceError) }) => void) |

Triggered when an error occurs during web page loading.
For best results, simplify the implementation logic in the callback.
**request**: encapsulation of a web page request.
**error**: encapsulation of a web page resource loading error.

| -| onHttpErrorReceive(callback: (event?: { request: [WebResourceRequest](#WebResourceError), response: [WebResourceResponse](#WebResourceResponse) }) => void) |

Triggered when an HTTP error (the response code is greater than or equal to 400) occurs during web page resource loading.
**request**: encapsulation of a web page request.
**response**: encapsulation of a web page response.

| +| onHttpErrorReceive(callback: (event?: { request: [WebResourceRequest](#WebResourceError), response: [WebResourceResponse](#WebResourceResponse) }) => void) |

Triggered when an HTTP error (the response code is greater than or equal to 400) occurs during web page resource loading.
**request**: encapsulation of a web page request.
**response**: encapsulation of a web page response.

| | onPageBegin(callback: (event?: { url: string }) => void) |

Triggered when the web page starts to be loaded. This API is triggered only for the main frame content, and not for the iframe or frameset content.
**url**: URL of the page.

| | onPageEnd(callback: (event?: { url: string }) => void) |

Triggered when the web page loading is complete. This API is triggered only for the main frame content.
**url**: URL of the page.

| | onProgressChange(callback: (event?: { newProgress: number }) => void) |

Triggered when the web page loading progress changes.
**newProgress**: new loading progress. The value is an integer ranging from 0 to 100.

| @@ -127,10 +130,10 @@ Describes the request/response header object returned by the **\** componen - Parameters - | Name | Description | - | ----------- | ---------------------- | - | headerKey: string |

Key of the request/response header.

| - | headerValue: string |

Value of the request/response header.

| + | Name | Type |Description | + | ----------- | ----------- |---------------------- | + | headerKey | string |Key of the request/response header.| + | headerValue | string |Value of the request/response header.| ### WebResourceResponse @@ -178,7 +181,13 @@ Indicates whether a specific number of steps forward or backward can be performe | Name | Type | Mandatory | Default Value | Description | | ---- | ------ | ---- | ---- | --------------------- | - | step | number | Yes | - | Number of the steps to take. A positive number means to going forward, and a negative number means to going backward. | + | step | number | Yes | - | Number of the steps to take. A positive number means to going forward, and a negative number means to going backward.| + +- Return value + + | Type | Description | + | ---- | ------ | + | boolean | Whether to go forward or backward from the current page.| ### backward