Implements a **WebviewController** to control the behavior of the **\<Web>** component. A **WebviewController** can control only one **\<Web>** component, and the APIs (except static APIs) in the **WebviewController** can be invoked only after it has been bound to the target **\<Web>** component.
Implements a **WebviewController** to control the behavior of the **\<Web>** component. A **WebviewController** can control only one **\<Web>** component, and the APIs (except static APIs) in the **WebviewController** can be invoked only after it has been bound to the target **\<Web>** component.
3. Using a sandbox path. For details, see the example of loading local resource files in the sandbox in [Web](../arkui-ts/ts-basic-components-web.md#web).
3. Using a sandbox path. For details, see the example of loading local resource files in the sandbox in [Web](../arkui-ts/ts-basic-components-web.md#web).
Example of loading local resource files in the sandbox:
Example of loading local resource files in the sandbox:
1. Use [globalthis](../../application-models/uiability-data-sync-with-ui.md#using-globalthis-between-uiability-and-page) to obtain the path of the sandbox.
1. Use [globalthis](../../application-models/uiability-data-sync-with-ui.md#using-globalthis-between-uiability-and-ui-page) to obtain the path of the sandbox.
The following uses **filesDir** as an example to describe how to obtain the path of the sandbox. For details about how to obtain other paths, see [Obtaining the Application Development Path](../../application-models/application-context-stage.md#obtaining-the-application-development-path).
The following uses **filesDir** as an example to describe how to obtain the path of the sandbox. For details about how to obtain other paths, see [Obtaining Application File Paths](../../application-models/application-context-stage.md#obtaining-application-file-paths).
```ts
```ts
// xxx.ts
// xxx.ts
import UIAbility from '@ohos.app.ability.UIAbility';
import UIAbility from '@ohos.app.ability.UIAbility';
Called when an SSL error occurs during resource loading.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [onSslErrorEventReceive<sup>9+</sup>](#onsslerroreventreceive9) instead.
Called to process an HTML form whose input type is **file**, in response to the tapping of the **Select File** button.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [onShowFileSelector<sup>9+</sup>](#onshowfileselector9) instead.
| request | [Webresourcerequest](#webresourcerequest) | Information about the URL request.|
| request | [WebResourceRequest](#webresourcerequest) | Information about the URL request.|
**Return value**
**Return value**
...
@@ -4933,6 +4979,7 @@ This API is deprecated since API version 9. You are advised to use [registerJava
...
@@ -4933,6 +4979,7 @@ This API is deprecated since API version 9. You are advised to use [registerJava
}
}
```
```
HTML file to be loaded:
```html
```html
<!-- index.html -->
<!-- index.html -->
<!DOCTYPE html>
<!DOCTYPE html>
...
@@ -4993,7 +5040,7 @@ This API is deprecated since API version 9. You are advised to use [runJavaScrip
...
@@ -4993,7 +5040,7 @@ This API is deprecated since API version 9. You are advised to use [runJavaScrip
}
}
}
}
```
```
HTML file to be loaded:
```html
```html
<!-- index.html -->
<!-- index.html -->
<!DOCTYPE html>
<!DOCTYPE html>
...
@@ -5009,7 +5056,6 @@ This API is deprecated since API version 9. You are advised to use [runJavaScrip
...
@@ -5009,7 +5056,6 @@ This API is deprecated since API version 9. You are advised to use [runJavaScrip
}
}
</script>
</script>
</html>
</html>
```
```
### stop<sup>(deprecated)</sup>
### stop<sup>(deprecated)</sup>
...
@@ -5075,17 +5121,12 @@ This API is deprecated since API version 9. You are advised to use [clearHistory
...
@@ -5075,17 +5121,12 @@ This API is deprecated since API version 9. You are advised to use [clearHistory
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.
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>(deprecated)</sup>
### setCookie<sup>(deprecated)</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.
setCookie(): boolean
This API is deprecated since API version 9. You are advised to use [setCookie<sup>9+</sup>](../apis/js-apis-webview.md#setcookie) instead.
**Parameters**
Sets the cookie. This API returns the result synchronously. Returns **true** if the operation is successful; returns **false** otherwise.
| Name | Type | Mandatory | Default Value | Description |
This API is deprecated since API version 9. You are advised to use [setCookie<sup>9+</sup>](../apis/js-apis-webview.md#setcookie) instead.
@@ -28,8 +28,17 @@ To use DevTools for frontend page debugging, perform the following steps:
...
@@ -28,8 +28,17 @@ To use DevTools for frontend page debugging, perform the following steps:
}
}
}
}
```
```
2. Declare the required permission in the **module.json5** file of the application project in DevEco Studio.
2. Connect your device to a PC, and configure port mapping on the PC as follows:
```
"requestPermissions":[
{
"name" : "ohos.permission.INTERNET"
}
]
```
3. Connect your device to a PC, and configure port mapping on the PC as follows:
```
```
// Configure port mapping.
// Configure port mapping.
...
@@ -38,7 +47,7 @@ To use DevTools for frontend page debugging, perform the following steps:
...
@@ -38,7 +47,7 @@ To use DevTools for frontend page debugging, perform the following steps:
hdc fport ls
hdc fport ls
```
```
3. Enter **chrome://inspect/\#devices** in the address box of the Chrome browser on the PC. Once the device is identified, you can get started with page debugging. The debugging effect is as follows:
4. Enter **chrome://inspect/\#devices** in the address box of the Chrome browser on the PC. Once the device is identified, you can get started with page debugging. The debugging effect is as follows: