| boolean | Whether any saved HTTP authentication credentials exist. Returns **true** if any saved HTTP authentication credentials exist exists; returns **false** otherwise.|
| boolean | Whether any saved HTTP authentication credentials exist. Returns **true** if any saved HTTP authentication credentials exist; returns **false** otherwise. |
**Example**
**Example**
...
@@ -4165,133 +4229,6 @@ struct WebComponent {
...
@@ -4165,133 +4229,6 @@ struct WebComponent {
}
}
```
```
## WebAsyncController
Implements a **WebAsyncController** object, which can be used to control the behavior of a **\<Web>** component with asynchronous callbacks. A **WebAsyncController **object controls one **\<Web>** component.
| baseName | string | Yes| Save path. The value cannot be null. |
| autoName | boolean | Yes| Whether to automatically generate a file name.<br>The value **false** means not to automatically generate a file name.<br>The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. |
| callback | AsyncCallback\<string> | Yes | Callback used to return the save path if the operation is successful and null otherwise.|
| baseName | string | Yes| Save path. The value cannot be null. |
| autoName | boolean | Yes| Whether to automatically generate a file name.<br>The value **false** means not to automatically generate a file name.<br>The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. |
@@ -4680,7 +4617,7 @@ Provides the element information of the area being clicked. For details about th
...
@@ -4680,7 +4617,7 @@ Provides the element information of the area being clicked. For details about th
| Name| Type| Readable| Writable| Description|
| Name| Type| Readable| Writable| Description|
| ---- | ---- | ---- | ---- |---- |
| ---- | ---- | ---- | ---- |---- |
| type | [HitTestTypeV9](#hittesttypev9) | Yes| No| Element type of the area being clicked.|
| type | [WebHitTestType](#webhittesttype) | Yes| No| Element type of the area being clicked.|
| extra | string | Yes| No|Extra information of the area being clicked. If the area being clicked is an image or a link, the extra information is the URL of the image or link.|
| extra | string | Yes| No|Extra information of the area being clicked. If the area being clicked is an image or a link, the extra information is the URL of the image or link.|
## WebMessage
## WebMessage
...
@@ -4749,7 +4686,7 @@ import image from "@ohos.multimedia.image"
...
@@ -4749,7 +4686,7 @@ import image from "@ohos.multimedia.image"
Sets whether to display the horizontal scrollbar, including the system default scrollbar and custom scrollbar. By default, the horizontal scrollbar is displayed.
Sets whether to display the horizontal scrollbar, including the default system scrollbar and custom scrollbar. By default, the horizontal scrollbar is displayed.
**Parameters**
**Parameters**
...
@@ -577,7 +578,7 @@ Sets whether to display the horizontal scrollbar, including the system default s
...
@@ -577,7 +578,7 @@ Sets whether to display the horizontal scrollbar, including the system default s
Sets whether to display the vertical scrollbar, including the system default scrollbar and custom scrollbar. By default, the vertical scrollbar is displayed.
Sets whether to display the vertical scrollbar, including the default system scrollbar and custom scrollbar. By default, the vertical scrollbar is displayed.
**Parameters**
**Parameters**
...
@@ -745,36 +746,6 @@ Sets the user agent.
...
@@ -745,36 +746,6 @@ Sets the user agent.
}
}
```
```
### webDebuggingAccess<sup>9+</sup>
webDebuggingAccess(webDebuggingAccess: boolean)
Sets whether to enable web debugging.
**Parameters**
| Name | Type | Mandatory | Default Value | Description |
Called when an error occurs during web page loading. For better results, simplify the implementation logic in the callback.
Called when an error occurs during web page loading. For better results, simplify the implementation logic in the callback. This API is called when there is no network connection.
**Parameters**
**Parameters**
...
@@ -1556,7 +1528,7 @@ Called when an error occurs during web page loading. For better results, simplif
...
@@ -1556,7 +1528,7 @@ Called when an error occurs during web page loading. For better results, simplif
console.info(`onInterceptKeyEvent get event.keyCode ${event.keyCode}`)
console.info(`onInterceptKeyEvent get event.keyCode ${event.keyCode}`)
returntrue;
returntrue;
}
}
...
@@ -3162,18 +3134,6 @@ Instructs the **\<Web>** component to select a file.
...
@@ -3162,18 +3134,6 @@ Instructs the **\<Web>** component to select a file.
Implements the **FileSelectorParam** object. For the sample code, see [onShowFileSelector](#onshowfileselector9).
Implements the **FileSelectorParam** object. For the sample code, see [onShowFileSelector](#onshowfileselector9).
### getTitle<sup>9+</sup>
getTitle(): string
Obtains the title of the file selector.
**Return value**
| Type | Description |
| ------ | ---------- |
| string | Title of the file selector.|
### getMode<sup>9+</sup>
### getMode<sup>9+</sup>
getMode(): FileSelectorMode
getMode(): FileSelectorMode
...
@@ -3611,7 +3571,7 @@ This API is deprecated since API version 9. You are advised to use [requestFocus
...
@@ -3611,7 +3571,7 @@ This API is deprecated since API version 9. You are advised to use [requestFocus
@Component
@Component
structWebComponent{
structWebComponent{
controller:WebController=newWebController()
controller:WebController=newWebController()
build(){
build(){
Column(){
Column(){
Button('requestFocus')
Button('requestFocus')
...
@@ -3646,7 +3606,7 @@ This API is deprecated since API version 9. You are advised to use [accessBackwa
...
@@ -3646,7 +3606,7 @@ This API is deprecated since API version 9. You are advised to use [accessBackwa
@Component
@Component
structWebComponent{
structWebComponent{
controller:WebController=newWebController()
controller:WebController=newWebController()
build(){
build(){
Column(){
Column(){
Button('accessBackward')
Button('accessBackward')
...
@@ -3682,7 +3642,7 @@ This API is deprecated since API version 9. You are advised to use [accessForwar
...
@@ -3682,7 +3642,7 @@ This API is deprecated since API version 9. You are advised to use [accessForwar
@Component
@Component
structWebComponent{
structWebComponent{
controller:WebController=newWebController()
controller:WebController=newWebController()
build(){
build(){
Column(){
Column(){
Button('accessForward')
Button('accessForward')
...
@@ -3725,7 +3685,7 @@ This API is deprecated since API version 9. You are advised to use [accessStep<s
...
@@ -3725,7 +3685,7 @@ This API is deprecated since API version 9. You are advised to use [accessStep<s
structWebComponent{
structWebComponent{
controller:WebController=newWebController()
controller:WebController=newWebController()
@Statesteps:number=2
@Statesteps:number=2
build(){
build(){
Column(){
Column(){
Button('accessStep')
Button('accessStep')
...
@@ -3755,7 +3715,7 @@ This API is deprecated since API version 9. You are advised to use [backward<sup
...
@@ -3755,7 +3715,7 @@ This API is deprecated since API version 9. You are advised to use [backward<sup
@Component
@Component
structWebComponent{
structWebComponent{
controller:WebController=newWebController()
controller:WebController=newWebController()
build(){
build(){
Column(){
Column(){
Button('backward')
Button('backward')
...
@@ -3784,7 +3744,7 @@ This API is deprecated since API version 9. You are advised to use [forward<sup>
...
@@ -3784,7 +3744,7 @@ This API is deprecated since API version 9. You are advised to use [forward<sup>
@Component
@Component
structWebComponent{
structWebComponent{
controller:WebController=newWebController()
controller:WebController=newWebController()
build(){
build(){
Column(){
Column(){
Button('forward')
Button('forward')
...
@@ -3797,40 +3757,6 @@ This API is deprecated since API version 9. You are advised to use [forward<sup>
...
@@ -3797,40 +3757,6 @@ This API is deprecated since API version 9. You are advised to use [forward<sup>
}
}
```
```
### backOrForward<sup>9+</sup>
backOrForward(step: number): void
Performs a specific number of steps forward or backward on the current page based on the history stack. No redirection will be performed if the corresponding page does not exist in the history stack.
**Parameters**
| Name | Type | Mandatory | Default Value | Description |
| ---- | ------ | ---- | ---- | ----------- |
| step | number | Yes | - | Number of the steps to take.|
@@ -4558,769 +4291,42 @@ Clears the user operation corresponding to the SSL certificate error event recor
...
@@ -4558,769 +4291,42 @@ Clears the user operation corresponding to the SSL certificate error event recor
}
}
```
```
### clearClientAuthenticationCache
## WebCookie
clearClientAuthenticationCache(): void
Manages behavior of cookies in **\<Web>** components. All **\<Web>** components in an application share a **WebCookie**. You can use the **getCookieManager** API in **controller** to obtain the **WebCookie** for subsequent cookie management.
Clears the user operation corresponding to the client certificate request event recorded by the **\<Web>** component.
### setCookie<sup>9+</sup>
setCookie(url: string, value: string): boolean
**Example**
Sets the cookie. This API returns the result synchronously. Returns **true** if the operation is successful; returns **false** otherwise.
Searches the web page for content that matches the keyword specified by **'searchString'** and highlights the matches on the page. This API returns the result asynchronously through [onSearchResultReceive](#onsearchresultreceive9).
**Parameters**
| Name | Type | Mandatory | Default Value | Description |
| [HitTestType](#hittesttype)| Element type of the area being clicked.|
### getExtra<sup>9+</sup>
getExtra(): string
Obtains the extra information of the area being clicked. If the area being clicked is an image or a link, the extra information is the URL of the image or link.
**Return value**
| Type | Description |
| ------ | ------------ |
| string | Extra information of the area being clicked.|
## WebCookie
Manages behavior of cookies in **\<Web>** components. All **\<Web>** components in an application share a **WebCookie**. You can use the **getCookieManager** API in **controller** to obtain the **WebCookie** for subsequent cookie management.
### setCookie<sup>9+</sup>
setCookie(url: string, value: string): boolean
Sets the cookie. This API returns the result synchronously. Returns **true** if the operation is successful; returns **false** otherwise.
**Parameters**
| Name | Type | Mandatory | Default Value | Description |
@@ -5466,324 +4450,6 @@ Enumerates the error codes returned by **onSslErrorEventReceive** API.
...
@@ -5466,324 +4450,6 @@ Enumerates the error codes returned by **onSslErrorEventReceive** API.
| On | The web dark mode is enabled. |
| On | The web dark mode is enabled. |
| Auto | The web dark mode setting follows the system settings. |
| Auto | The web dark mode setting follows the system settings. |
## WebAsyncController
Implements a **WebAsyncController** object, which can be used to control the behavior of a **\<Web>** component with asynchronous callbacks. A **WebAsyncController **object controls one **\<Web>** component.
### Creating an Object
```
webController: WebController = new WebController();
webAsyncController: WebAsyncController = new WebAsyncController(webController);
| baseName | string | Yes | Save path. The value cannot be null. |
| autoName | boolean | Yes | Whether to automatically generate a file name.<br/>The value **false** means not to automatically generate a file name.<br/>The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. |
| callback | AsyncCallback\<string> | Yes | Callback used to return the save path if the operation is successful and null otherwise. |
| baseName | string | Yes | Save path. The value cannot be null. |
| autoName | boolean | Yes | Whether to automatically generate a file name.<br>The value **false** means not to automatically generate a file name.<br>The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. |
Compared with earlier versions, OpenHarmony 3.2.10.7 has the following API changes in its web subsystem:
## cl.web.1 HitTestTypeV9 Name Change
Renamed the enum class **HitTestTypeV9****WebHitTestType** to meet the naming conventions.
**Change Impact**
The enum class **HitTestTypeV9** and APIs that use **HitTestTypeV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
enum HitTestTypeV9
- Before change:
```ts
enumHitTestTypeV9
```
- After change:
```ts
enumWebHitTestType
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.2 HeaderV9 Name Change
Renamed the struct **HeaderV9****WebHeader** to meet the naming conventions.
**Change Impact**
The struct **HeaderV9** and APIs that use **HeaderV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HeaderV9
- Before change:
```ts
interfaceHeaderV9
```
- After change:
```ts
interfaceWebHeader
```
**Adaptation Guide**
Replace **HeaderV9** with **WebHeader**.
## cl.web.3 Member Change of HitTestValue
Rename the member variable **HitTestTypeV9** in the **HitTestValue** struct **WebHitTestType** to meet the naming conventions.
**Change Impact**
The struct **HitTestValue** and APIs that use **HitTestValue** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HitTestValue
- Before change:
```ts
interfaceHitTestValue{
/**
* Get the hit test type.
*
* @since 9
*/
type:HitTestTypeV9;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra:string;
}
```
- After change:
```ts
interfaceHitTestValue{
/**
* Get the hit test type.
*
* @since 9
*/
type:WebHitTestType;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra:string;
}
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.4 Parameter Type Change of loadUrl
Changed the type of the **headers** parameter in **loadUrl** to **WebHeader** to meet the naming conventions.
**Change Impact**
The **loadUrl** API that uses the **headers** parameter cannot be used in OpenHarmony 3.2.10.7 and later versions.
Change the type of the **headers** parameter in **loadUrl** from **HeaderV9** to **WebHeader**.
## cl.web.5 Return Value Type Change of getHitTest
Changed the return value type of the **getHitTest** API to **WebHitTest** to meet the naming conventions.
**Change Impact**
The **getHitTest** API cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
getHitTest(): HitTestTypeV9
- Before change:
```ts
getHitTest():HitTestTypeV9
```
- After change:
```ts
getHitTest():WebHitTestType
```
**Adaptation Guide**
Change the return value type of the **getHitTest** API from **HitTestTypeV9** to **WebHitTestType**.
## cl.web.6 Moving of the WebMessagePort Class
Moved the **WebMessagePort** class to **@ohos.web.webview.d.ts** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@ohos.web.webview';
```
## cl.web.7 Moving of the HitTestValue Class
Moved the **HitTestValue** class to **@ohos.web.webview.d.ts**; changed **HitTestValue** from a class to an API; changed the **getType** and **getExtra** from APIs to attributes.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed.
**Key API/Component Changes**
- Involved APIs:
getType(): HitTestType;
getExtra(): string;
- Before change:
```ts
getType():HitTestType;
getExtra():string;
```
- After change:
```ts
type:WebHitTestType;
extra:string;
```
**Adaptation Guide**
Instead of importing APIs from the original **HitTestValue** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@ohos.web.webview';
```
## cl.web.8 Moving of API Version 9 APIs Under WebCookie
Moved APIs of API version 9 in the **WebCookie** class to **web.webview.webview.WebCookieManager**
and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@ohos.web.webview';
```
## cl.web.9 Moving of API Version 9 APIs Under WebController
Moved APIs of API version 9 in the **WebController** class to **web.webview.webview.WebviewController** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
The **getDefaultUserAgent** API is renamed **getUserAgent**.
Compared with earlier versions, OpenHarmony 4.0.3.2 has the following API changes in its web subsystem:
## cl.web.1 HitTestTypeV9 Name Change
Renamed the enum class **HitTestTypeV9****WebHitTestType** to meet the naming conventions.
**Change Impact**
The enum class **HitTestTypeV9** and APIs that use **HitTestTypeV9** as a parameter or return value cannot be used in OpenHarmony 4.0.3.2 and later versions.
**Key API/Component Changes**
- Involved APIs:
enum HitTestTypeV9
- Before change:
```ts
enumHitTestTypeV9
```
- After change:
```ts
enumWebHitTestType
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.2 HeaderV9 Name Change
Renamed the struct **HeaderV9****WebHeader** to meet the naming conventions.
**Change Impact**
The struct **HeaderV9** and APIs that use **HeaderV9** as a parameter or return value cannot be used in OpenHarmony 4.0.3.2 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HeaderV9
- Before change:
```ts
interfaceHeaderV9
```
- After change:
```ts
interfaceWebHeader
```
**Adaptation Guide**
Replace **HeaderV9** with **WebHeader**.
## cl.web.3 Member Change of HitTestValue
Rename the member variable **HitTestTypeV9** in the **HitTestValue** struct **WebHitTestType** to meet the naming conventions.
**Change Impact**
The struct **HitTestValue** and APIs that use **HitTestValue** as a parameter or return value cannot be used in OpenHarmony 4.0.3.2 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HitTestValue
- Before change:
```ts
interfaceHitTestValue{
/**
* Get the hit test type.
*
* @since 9
*/
type:HitTestTypeV9;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra:string;
}
```
- After change:
```ts
interfaceHitTestValue{
/**
* Get the hit test type.
*
* @since 9
*/
type:WebHitTestType;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra:string;
}
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.4 Parameter Type Change of loadUrl
Changed the type of the **headers** parameter in **loadUrl** to **WebHeader** to meet the naming conventions.
**Change Impact**
The **loadUrl** API that uses the **headers** parameter cannot be used in OpenHarmony 4.0.3.2 and later versions.
Change the type of the **headers** parameter in **loadUrl** from **HeaderV9** to **WebHeader**.
## cl.web.5 Return Value Type Change of getHitTest
Changed the return value type of the **getHitTest** API to **WebHitTest** to meet the naming conventions.
**Change Impact**
The **getHitTest** API cannot be used in OpenHarmony 4.0.3.2 and later versions.
**Key API/Component Changes**
- Involved APIs:
getHitTest(): HitTestTypeV9
- Before change:
```ts
getHitTest():HitTestTypeV9
```
- After change:
```ts
getHitTest():WebHitTestType
```
**Adaptation Guide**
Change the return value type of the **getHitTest** API from **HitTestTypeV9** to **WebHitTestType**.
## cl.web.6 Moving of the WebMessagePort Class
Moved the **WebMessagePort** class to **@ohos.web.webview.d.ts** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@ohos.web.webview';
```
## cl.web.7 Moving of the HitTestValue Class
Moved the **HitTestValue** class to **@ohos.web.webview.d.ts**; changed **HitTestValue** from a class to an API; changed the **getType** and **getExtra** from APIs to attributes.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed.
**Key API/Component Changes**
- Involved APIs:
getType(): HitTestType;
getExtra(): string;
- Before change:
```ts
getType():HitTestType;
getExtra():string;
```
- After change:
```ts
type:WebHitTestType;
extra:string;
```
**Adaptation Guide**
Instead of importing APIs from the original **HitTestValue** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@ohos.web.webview';
```
## cl.web.8 Moving of API Version 9 APIs Under WebCookie
Moved APIs of API version 9 in the **WebCookie** class to **web.webview.webview.WebCookieManager**
and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@ohos.web.webview';
```
## cl.web.9 Moving of API Version 9 APIs Under WebController
Moved APIs of API version 9 in the **WebController** class to **web.webview.webview.WebviewController** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
The **getDefaultUserAgent** API is renamed **getUserAgent**.