diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
index eb99d96c45b06369150673cd442cf5bd1d61d746..1f5c45dffa15770a6b9e4f4df8922268c2ff0b9b 100755
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
@@ -1763,7 +1763,7 @@ onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean
}
```
-### onRenderExited
+### onRenderExited9+
onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => void)
@@ -3539,24 +3539,28 @@ invoke(origin: string, allow: boolean, retain: boolean): void
| ------ | ------- | ---- | ---- | ---------------------------------------- |
| origin | string | 是 | - | 指定源的字符串索引。 |
| allow | boolean | 是 | - | 设置的地理位置权限状态。 |
-| retain | boolean | 是 | - | 是否允许将地理位置权限状态保存到系统中。可通过[GeolocationPermissions](#geolocationpermissions9)接口管理保存到系统的地理位置权限。 |
+| retain | boolean | 是 | - | 是否允许将地理位置权限状态保存到系统中。可通过[GeolocationPermissions9+](../apis/js-apis-webview.md#geolocationpermissions)接口管理保存到系统的地理位置权限。 |
## WebController
通过WebController可以控制Web组件各种行为。一个WebController对象只能控制一个Web组件,且必须在Web组件和WebController绑定后,才能调用WebController上的方法。
+从API version 9开始不再维护,建议使用[WebviewController9+](../apis/js-apis-webview.md#webviewcontroller)代替。
+
### 创建对象
```
webController: WebController = new WebController()
```
-### requestFocus
+### requestFocus(deprecated)
requestFocus()
使当前web页面获取焦点。
+从API version 9开始不再维护,建议使用[requestFocus9+](../apis/js-apis-webview.md#requestfocus)代替。
+
**示例:**
```ts
@@ -3578,12 +3582,14 @@ requestFocus()
}
```
-### accessBackward
+### accessBackward(deprecated)
accessBackward(): boolean
当前页面是否可后退,即当前页面是否有返回历史记录。
+从API version 9开始不再维护,建议使用[accessBackward9+](../apis/js-apis-webview.md#accessbackward)代替。
+
**返回值:**
| 类型 | 说明 |
@@ -3612,12 +3618,14 @@ accessBackward(): boolean
}
```
-### accessForward
+### accessForward(deprecated)
accessForward(): boolean
当前页面是否可前进,即当前页面是否有前进历史记录。
+从API version 9开始不再维护,建议使用[accessForward9+](../apis/js-apis-webview.md#accessforward)代替。
+
**返回值:**
| 类型 | 说明 |
@@ -3646,12 +3654,14 @@ accessForward(): boolean
}
```
-### accessStep
+### accessStep(deprecated)
accessStep(step: number): boolean
当前页面是否可前进或者后退给定的step步。
+从API version 9开始不再维护,建议使用[accessStep9+](../apis/js-apis-webview.md#accessstep)代替。
+
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
@@ -3687,12 +3697,14 @@ accessStep(step: number): boolean
}
```
-### backward
+### backward(deprecated)
backward(): void
按照历史栈,后退一个页面。一般结合accessBackward一起使用。
+从API version 9开始不再维护,建议使用[backward9+](../apis/js-apis-webview.md#backward)代替。
+
**示例:**
```ts
@@ -3714,12 +3726,14 @@ backward(): void
}
```
-### forward
+### forward(deprecated)
forward(): void
按照历史栈,前进一个页面。一般结合accessForward一起使用。
+从API version 9开始不再维护,建议使用[forward9+](../apis/js-apis-webview.md#forward)代替。
+
**示例:**
```ts
@@ -3775,12 +3789,14 @@ backOrForward(step: number): void
}
```
-### deleteJavaScriptRegister
+### deleteJavaScriptRegister(deprecated)
deleteJavaScriptRegister(name: string)
删除通过registerJavaScriptProxy注册到window上的指定name的应用侧JavaScript对象。删除后立即生效,无须调用[refresh](#refresh)接口。
+从API version 9开始不再维护,建议使用[deleteJavaScriptRegister9+](../apis/js-apis-webview.md#deletejavascriptregister)代替。
+
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
@@ -3809,12 +3825,14 @@ deleteJavaScriptRegister(name: string)
}
```
-### getHitTest
+### getHitTest(deprecated)
getHitTest(): HitTestType
获取当前被点击区域的元素类型。
+从API version 9开始不再维护,建议使用[getHitTest9+](../apis/js-apis-webview.md#gethittest)代替。
+
**返回值:**
| 类型 | 说明 |
@@ -4009,7 +4027,7 @@ getDefaultUserAgent(): string
}
```
-### loadData
+### loadData(deprecated)
loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string })
@@ -4019,6 +4037,8 @@ baseUrl为空时,通过”data“协议加载指定的一段字符串。
当baseUrl为“http/https"协议时,编码后的data字符串将被Web组件以类似loadUrl的方式以非编码字符串处理。
+从API version 9开始不再维护,建议使用[loadData9+](../apis/js-apis-webview.md#loaddata)代替。
+
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
@@ -4054,7 +4074,7 @@ baseUrl为空时,通过”data“协议加载指定的一段字符串。
}
```
-### loadUrl
+### loadUrl(deprecated)
loadUrl(options: { url: string | Resource, headers?: Array\ })
@@ -4064,6 +4084,8 @@ loadUrl(options: { url: string | Resource, headers?: Array\ })
而通过registerJavaScriptProxy注入的对象,在loadUrl导航到新的页面也会有效。
+从API version 9开始不再维护,建议使用[loadUrl9+](../apis/js-apis-webview.md#loadurl)代替。
+
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
@@ -4092,12 +4114,14 @@ loadUrl(options: { url: string | Resource, headers?: Array\ })
}
```
-### onActive
+### onActive(deprecated)
onActive(): void
调用此接口通知Web组件进入前台激活状态。
+从API version 9开始不再维护,建议使用[onActive9+](../apis/js-apis-webview.md#onactive)代替。
+
**示例:**
```ts
@@ -4119,12 +4143,14 @@ onActive(): void
}
```
-### onInactive
+### onInactive(deprecated)
onInactive(): void
调用此接口通知Web组件进入未激活状态。
+从API version 9开始不再维护,建议使用[onInactive9+](../apis/js-apis-webview.md#oninactive)代替。
+
**示例:**
```ts
@@ -4146,11 +4172,13 @@ onInactive(): void
}
```
-### zoom
+### zoom(deprecated)
zoom(factor: number): void
调整当前网页的缩放比例。
+从API version 9开始不再维护,建议使用[zoom9+](../apis/js-apis-webview.md#zoom)代替。
+
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
@@ -4245,12 +4273,14 @@ zoomOut(): boolean
}
```
-### refresh
+### refresh(deprecated)
refresh()
调用此接口通知Web组件刷新网页。
+从API version 9开始不再维护,建议使用[refresh9+](../apis/js-apis-webview.md#refresh)代替。
+
**示例:**
```ts
@@ -4272,12 +4302,14 @@ refresh()
}
```
-### registerJavaScriptProxy
+### registerJavaScriptProxy(deprecated)
registerJavaScriptProxy(options: { object: object, name: string, methodList: Array\ })
注入JavaScript对象到window对象中,并在window对象中调用该对象的方法。注册后,须调用[refresh](#refresh)接口生效。
+从API version 9开始不再维护,建议使用[registerJavaScriptProxy9+](../apis/js-apis-webview.md#registerjavascriptproxy)代替。
+
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
@@ -4338,12 +4370,14 @@ registerJavaScriptProxy(options: { object: object, name: string, methodList: Arr
```
-### runJavaScript
+### runJavaScript(deprecated)
runJavaScript(options: { script: string, callback?: (result: string) => void })
异步执行JavaScript脚本,并通过回调方式返回脚本执行的结果。runJavaScript需要在loadUrl完成后,比如onPageEnd中调用。
+从API version 9开始不再维护,建议使用[runJavaScript9+](../apis/js-apis-webview.md#runjavascript)代替。
+
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
@@ -4397,12 +4431,14 @@ runJavaScript(options: { script: string, callback?: (result: string) => void })
```
-### stop
+### stop(deprecated)
stop()
停止页面加载。
+从API version 9开始不再维护,建议使用[stop9+](../apis/js-apis-webview.md#stop)代替。
+
**示例:**
```ts
@@ -4424,12 +4460,14 @@ stop()
}
```
-### clearHistory
+### clearHistory(deprecated)
clearHistory(): void
删除所有前进后退记录。
+从API version 9开始不再维护,建议使用[clearHistory9+](../apis/js-apis-webview.md#clearhistory)代替。
+
**示例:**
```ts
@@ -5007,40 +5045,6 @@ setCookie(url: string, value: string): boolean
}
```
-### saveCookieSync9+
-saveCookieSync(): boolean
-
-将当前存在内存中的cookie保存到磁盘中,该方法为同步方法。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------- | -------------------- |
-| boolean | 同步内存cookie到磁盘操作是否成功。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('saveCookieSync')
- .onClick(() => {
- let result = web_webview.WebCookieManager.saveCookieSync()
- console.log("result: " + result)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
### saveCookieAsync9+
saveCookieAsync(): Promise\
@@ -5337,837 +5341,81 @@ deleteSessionCookie(): void
}
```
-## WebDataBase9+
-web组件数据库管理对象。
-
-### existHttpAuthCredentials9+
-
-static existHttpAuthCredentials(): boolean
-
-判断是否存在任何已保存的HTTP身份验证凭据,该方法为同步方法。存在返回true,不存在返回false。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------- | ---------------------------------------- |
-| boolean | 是否存在任何已保存的HTTP身份验证凭据。存在返回true,不存在返回false |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('existHttpAuthCredentials')
- .onClick(() => {
- let result = web_webview.WebDataBase.existHttpAuthCredentials()
- console.log('result: ' + result)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### deleteHttpAuthCredentials9+
-
-static deleteHttpAuthCredentials(): void
-
-清除所有已保存的HTTP身份验证凭据,该方法为同步方法。
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
-
- build() {
- Column() {
- Button('deleteHttpAuthCredentials')
- .onClick(() => {
- web_webview.WebDataBase.deleteHttpAuthCredentials()
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### getHttpAuthCredentials9+
-
-static getHttpAuthCredentials(host: string, realm: string): Array\
-
-检索给定主机和域的HTTP身份验证凭据,该方法为同步方法。检索成功返回一个包含用户名和密码的组数,检索不成功返回空数组。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| ----- | ------ | ---- | ---- | ---------------- |
-| host | string | 是 | - | HTTP身份验证凭据应用的主机。 |
-| realm | string | 是 | - | HTTP身份验证凭据应用的域。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| --------------- | ---------------------- |
-| Array\ | 包含用户名和密码的组数,检索失败返回空数组。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- host: string = "www.spincast.org"
- realm: string = "protected example"
- username_password: string[]
- build() {
- Column() {
- Button('getHttpAuthCredentials')
- .onClick(() => {
- this.username_password = web_webview.WebDataBase.getHttpAuthCredentials(this.host, this.realm)
- console.log('num: ' + this.username_password.length)
- ForEach(this.username_password, (item) => {
- console.log('username_password: ' + item)
- }, item => item)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### saveHttpAuthCredentials9+
-
-static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void
-
-保存给定主机和域的HTTP身份验证凭据,该方法为同步方法。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| -------- | ------ | ---- | ---- | ---------------- |
-| host | string | 是 | - | HTTP身份验证凭据应用的主机。 |
-| realm | string | 是 | - | HTTP身份验证凭据应用的域。 |
-| username | string | 是 | - | 用户名。 |
-| password | string | 是 | - | 密码。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- host: string = "www.spincast.org"
- realm: string = "protected example"
- build() {
- Column() {
- Button('saveHttpAuthCredentials')
- .onClick(() => {
- web_webview.WebDataBase.saveHttpAuthCredentials(this.host, this.realm, "Stromgol", "Laroche")
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-## GeolocationPermissions9+
-
-web组件地理位置权限管理对象。
-
-### allowGeolocation9+
-
-static allowGeolocation(origin: string): void
+## MessageLevel枚举说明
-允许指定来源使用地理位置接口。
+| 名称 | 描述 |
+| ----- | :---- |
+| Debug | 调试级别。 |
+| Error | 错误级别。 |
+| Info | 消息级别。 |
+| Log | 日志级别。 |
+| Warn | 警告级别。 |
-**参数:**
+## RenderExitReason枚举说明
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| ------ | ------ | ---- | ---- | ---------- |
-| origin | string | 是 | - | 指定源的字符串索引。 |
+onRenderExited接口返回的渲染进程退出的具体原因。
-**示例:**
+| 名称 | 描述 |
+| -------------------------- | ----------------- |
+| ProcessAbnormalTermination | 渲染进程异常退出。 |
+| ProcessWasKilled | 收到SIGKILL,或被手动终止。 |
+| ProcessCrashed | 渲染进程崩溃退出,如段错误。 |
+| ProcessOom | 程序内存不足。 |
+| ProcessExitUnknown | 其他原因。 |
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "file:///"
- build() {
- Column() {
- Button('allowGeolocation')
- .onClick(() => {
- web_webview.GeolocationPermissions.allowGeolocation(this.origin)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
+## MixedMode枚举说明
-### deleteGeolocation9+
+| 名称 | 描述 |
+| ---------- | ---------------------------------- |
+| All | 允许加载HTTP和HTTPS混合内容。所有不安全的内容都可以被加载。 |
+| Compatible | 混合内容兼容性模式,部分不安全的内容可能被加载。 |
+| None | 不允许加载HTTP和HTTPS混合内容。 |
-static deleteGeolocation(origin: string): void
+## CacheMode枚举说明
+| 名称 | 描述 |
+| ------- | ------------------------------------ |
+| Default | 使用未过期的cache加载资源,如果cache中无该资源则从网络中获取。 |
+| None | 加载资源使用cache,如果cache中无该资源则从网络中获取。 |
+| Online | 加载资源不使用cache,全部从网络中获取。 |
+| Only | 只从cache中加载资源。 |
-清除指定来源的地理位置权限状态。
+## FileSelectorMode枚举说明
+| 名称 | 描述 |
+| -------------------- | ---------- |
+| FileOpenMode | 打开上传单个文件。 |
+| FileOpenMultipleMode | 打开上传多个文件。 |
+| FileOpenFolderMode | 打开上传文件夹模式。 |
+| FileSaveMode | 文件保存模式。 |
-**参数:**
+ ## HitTestType枚举说明
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| ------ | ------ | ---- | ---- | ---------- |
-| origin | string | 是 | - | 指定源的字符串索引。 |
+| 名称 | 描述 |
+| ------------- | ------------------------ |
+| EditText | 可编辑的区域。 |
+| Email | 电子邮件地址。 |
+| HttpAnchor | 超链接,其src为http。 |
+| HttpAnchorImg | 带有超链接的图片,其中超链接的src为http。 |
+| Img | HTML::img标签。 |
+| Map | 地理地址。 |
+| Phone | 电话号码。 |
+| Unknown | 未知内容。 |
-**示例:**
+## SslError9+枚举说明
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "file:///"
- build() {
- Column() {
- Button('deleteGeolocation')
- .onClick(() => {
- web_webview.GeolocationPermissions.deleteGeolocation(this.origin)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
+onSslErrorEventReceive接口返回的SSL错误的具体原因。
-### deleteAllGeolocation9+
+| 名称 | 描述 |
+| ------------ | ----------- |
+| Invalid | 一般错误。 |
+| HostMismatch | 主机名不匹配。 |
+| DateInvalid | 证书日期无效。 |
+| Untrusted | 证书颁发机构不受信任。 |
-static deleteAllGeolocation(): void
+## ProtectedResourceType9+枚举说明
-清除所有来源的地理位置权限状态。
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- build() {
- Column() {
- Button('deleteAllGeolocation')
- .onClick(() => {
- web_webview.GeolocationPermissions.deleteAllGeolocation()
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### getAccessibleGeolocation9+
-
-static getAccessibleGeolocation(origin: string, callback: AsyncCallback\): void
-
-以回调方式异步获取指定源的地理位置权限状态。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| -------- | ------------------------ | ---- | ---- | ---------------------------------------- |
-| origin | string | 是 | - | 指定源的字符串索引。 |
-| callback | AsyncCallback\ | 是 | - | 返回指定源的地理位置权限状态。获取成功,true表示已授权,false表示拒绝访问。获取失败,表示不存在指定源的权限状态。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "file:///"
- build() {
- Column() {
- Button('getAccessibleGeolocationAsync')
- .onClick(() => {
- web_webview.GeolocationPermissions.getAccessibleGeolocation(this.origin, (error, result) => {
- if (error) {
- console.log('getAccessibleGeolocationAsync error: ' + JSON.stringify(error))
- return
- }
- console.log('getAccessibleGeolocationAsync result: ' + result)
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### getAccessibleGeolocation9+
-
-static getAccessibleGeolocation(origin: string): Promise\
-
-以Promise方式异步获取指定源的地理位置权限状态。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| ------ | ------ | ---- | ---- | ---------- |
-| origin | string | 是 | - | 指定源的字符串索引。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| ------------------ | ---------------------------------------- |
-| Promise\ | Promise实例,用于获取指定源的权限状态,获取成功,true表示已授权,false表示拒绝访问。获取失败,表示不存在指定源的权限状态。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "file:///"
- build() {
- Column() {
- Button('getAccessibleGeolocationPromise')
- .onClick(() => {
- web_webview.GeolocationPermissions.getAccessibleGeolocation(this.origin).then(result => {
- console.log('getAccessibleGeolocationPromise result: ' + result)
- }).catch(error => {
- console.log('getAccessibleGeolocationPromise error: ' + JSON.stringify(error))
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### getStoredGeolocation9+
-
-static getStoredGeolocation(callback: AsyncCallback\\>): void
-
-以回调方式异步获取已存储地理位置权限状态的所有源信息。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| -------- | -------------------------------- | ---- | ---- | -------------------- |
-| callback | AsyncCallback\\> | 是 | - | 返回已存储地理位置权限状态的所有源信息。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- build() {
- Column() {
- Button('getStoredGeolocationAsync')
- .onClick(() => {
- web_webview.GeolocationPermissions.getStoredGeolocation((error, origins) => {
- if (error) {
- console.log('getStoredGeolocationAsync error: ' + JSON.stringify(error))
- return
- }
- let origins_str: string = origins.join()
- console.log('getStoredGeolocationAsync origins: ' + origins_str)
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### getStoredGeolocation9+
-
-static getStoredGeolocation(): Promise\\>
-
-以Promise方式异步获取已存储地理位置权限状态的所有源信息。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
-| -------- | -------------------------------- | ---- | ---- | -------------------- |
-| callback | AsyncCallback\\> | 是 | - | 返回已存储地理位置权限状态的所有源信息。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| -------------------------- | -------------------------------- |
-| Promise\\> | Promise实例,用于获取已存储地理位置权限状态的所有源信息。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- build() {
- Column() {
- Button('getStoredGeolocationPromise')
- .onClick(() => {
- web_webview.GeolocationPermissions.getStoredGeolocation().then(origins => {
- let origins_str: string = origins.join()
- console.log('getStoredGeolocationPromise origins: ' + origins_str)
- }).catch(error => {
- console.log('getStoredGeolocationPromise error: ' + JSON.stringify(error))
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-## WebStorage9+
-通过WebStorage可管理Web SQL数据库接口和HTML5 Web存储接口,每个应用中的所有Web组件共享一个WebStorage。
-### deleteAllData9+
-static deleteAllData(): void
-
-清除Web SQL数据库当前使用的所有存储。
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- build() {
- Column() {
- Button('deleteAllData')
- .onClick(() => {
- web_webview.WebStorage.deleteAllData()
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-### deleteOrigin9+
-static deleteOrigin(origin : string): void
-
-清除指定源所使用的存储。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ---------- |
-| origin | string | 是 | 指定源的字符串索引。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "origin"
- build() {
- Column() {
- Button('getHttpAuthCredentials')
- .onClick(() => {
- web_webview.WebStorage.deleteOrigin(this.origin)
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-### getOrigins9+
-static getOrigins(callback: AsyncCallback\>) : void
-
-以回调方式异步获取当前使用Web SQL数据库的所有源的信息。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| -------- | ---------------------------------------- | ---- | ----------------------------------- |
-| callback | AsyncCallback> | 是 | 以数组方式返回源的信息,信息内容参考WebStorageOrigin。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "origin"
- build() {
- Column() {
- Button('getOrigins')
- .onClick(() => {
- web_webview.WebStorage.getOrigins((error, origins) => {
- if (error) {
- console.log('error: ' + error)
- return
- }
- for (let i = 0; i < origins.length; i++) {
- console.log('origin: ' + origins[i].origin)
- console.log('usage: ' + origins[i].usage)
- console.log('quota: ' + origins[i].quota)
- }
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-### getOrigins9+
-static getOrigins() : Promise\>
-
-以Promise方式异步获取当前使用Web SQL数据库的所有源的信息。
-
-**返回值:**
-
-| 类型 | 说明 |
-| ---------------------------------------- | ---------------------------------------- |
-| Promise> | Promise实例,用于获取当前所有源的信息,信息内容参考WebStorageOrigin。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "origin"
- build() {
- Column() {
- Button('getOrigins')
- .onClick(() => {
- web_webview.WebStorage.getOrigins()
- .then(origins => {
- for (let i = 0; i < origins.length; i++) {
- console.log('origin: ' + origins[i].origin)
- console.log('usage: ' + origins[i].usage)
- console.log('quota: ' + origins[i].quota)
- }
- })
- .catch(error => {
- console.log('error: ' + error)
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-### getOriginQuota9+
-static getOriginQuota(origin : string, callback : AsyncCallback\) : void
-
-使用callback回调异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| -------- | ---------------------- | ---- | --------- |
-| origin | string | 是 | 指定源的字符串索引 |
-| callback | AsyncCallback\ | 是 | 指定源的存储配额。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- origin: string = "origin"
- build() {
- Column() {
- Button('getOriginQuota')
- .onClick(() => {
- web_webview.WebStorage.getOriginQuota(this.origin, (error, quota) => {
- if (error) {
- console.log('error: ' + error)
- return
- }
- console.log('quota: ' + quota)
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-### getOriginQuota9+
-static getOriginQuota(origin : string) : Promise\
-
-以Promise方式异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ---------- |
-| origin | string | 是 | 指定源的字符串索引。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| ---------------- | ----------------------- |
-| Promise\ | Promise实例,用于获取指定源的存储配额。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController();
- origin: string = "origin"
- build() {
- Column() {
- Button('getOriginQuota')
- .onClick(() => {
- web_webview.WebStorage.getOriginQuota(this.origin)
- .then(quota => {
- console.log('quota: ' + quota)
- })
- .catch(error => {
- console.log('error: ' + error)
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-### getOriginUsage9+
-static getOriginUsage(origin : string, callback : AsyncCallback\) : void
-
-以回调方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| -------- | ---------------------- | ---- | ---------- |
-| origin | string | 是 | 指定源的字符串索引。 |
-| callback | AsyncCallback\ | 是 | 指定源的存储量。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController();
- origin: string = "origin"
- build() {
- Column() {
- Button('getOriginUsage')
- .onClick(() => {
- web_webview.WebStorage.getOriginUsage(this.origin, (error, usage) => {
- if (error) {
- console.log('error: ' + error)
- return
- }
- console.log('usage: ' + usage)
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-### getOriginUsage9+
-static getOriginUsage(origin : string) : Promise\
-
-以Promise方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ---------- |
-| origin | string | 是 | 指定源的字符串索引。 |
-
-**返回值:**
-
-| 类型 | 说明 |
-| ---------------- | ---------------------- |
-| Promise\ | Promise实例,用于获取指定源的存储量。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController();
- origin: string = "origin"
- build() {
- Column() {
- Button('getOriginQuota')
- .onClick(() => {
- web_webview.WebStorage.getOriginUsage(this.origin)
- .then(usage => {
- console.log('usage: ' + usage)
- })
- .catch(error => {
- console.log('error: ' + error)
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- .databaseAccess(true)
- }
- }
- }
- ```
-
-## WebStorageOrigin9+
-
-提供Web SQL数据库的使用信息。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| ------ | ------ | ---- | ---------- |
-| origin | string | 是 | 指定源的字符串索引。 |
-| usage | number | 是 | 指定源的存储量。 |
-| quota | number | 是 | 指定源的存储配额。 |
-
-## MessageLevel枚举说明
-
-| 名称 | 描述 |
-| ----- | :---- |
-| Debug | 调试级别。 |
-| Error | 错误级别。 |
-| Info | 消息级别。 |
-| Log | 日志级别。 |
-| Warn | 警告级别。 |
-
-## RenderExitReason枚举说明
-
-onRenderExited接口返回的渲染进程退出的具体原因。
-
-| 名称 | 描述 |
-| -------------------------- | ----------------- |
-| ProcessAbnormalTermination | 渲染进程异常退出。 |
-| ProcessWasKilled | 收到SIGKILL,或被手动终止。 |
-| ProcessCrashed | 渲染进程崩溃退出,如段错误。 |
-| ProcessOom | 程序内存不足。 |
-| ProcessExitUnknown | 其他原因。 |
-
-## MixedMode枚举说明
-
-| 名称 | 描述 |
-| ---------- | ---------------------------------- |
-| All | 允许加载HTTP和HTTPS混合内容。所有不安全的内容都可以被加载。 |
-| Compatible | 混合内容兼容性模式,部分不安全的内容可能被加载。 |
-| None | 不允许加载HTTP和HTTPS混合内容。 |
-
-## CacheMode枚举说明
-| 名称 | 描述 |
-| ------- | ------------------------------------ |
-| Default | 使用未过期的cache加载资源,如果cache中无该资源则从网络中获取。 |
-| None | 加载资源使用cache,如果cache中无该资源则从网络中获取。 |
-| Online | 加载资源不使用cache,全部从网络中获取。 |
-| Only | 只从cache中加载资源。 |
-
-## FileSelectorMode枚举说明
-| 名称 | 描述 |
-| -------------------- | ---------- |
-| FileOpenMode | 打开上传单个文件。 |
-| FileOpenMultipleMode | 打开上传多个文件。 |
-| FileOpenFolderMode | 打开上传文件夹模式。 |
-| FileSaveMode | 文件保存模式。 |
-
- ## HitTestType枚举说明
-
-| 名称 | 描述 |
-| ------------- | ------------------------ |
-| EditText | 可编辑的区域。 |
-| Email | 电子邮件地址。 |
-| HttpAnchor | 超链接,其src为http。 |
-| HttpAnchorImg | 带有超链接的图片,其中超链接的src为http。 |
-| Img | HTML::img标签。 |
-| Map | 地理地址。 |
-| Phone | 电话号码。 |
-| Unknown | 未知内容。 |
-
-## SslError9+枚举说明
-
-onSslErrorEventReceive接口返回的SSL错误的具体原因。
-
-| 名称 | 描述 |
-| ------------ | ----------- |
-| Invalid | 一般错误。 |
-| HostMismatch | 主机名不匹配。 |
-| DateInvalid | 证书日期无效。 |
-| Untrusted | 证书颁发机构不受信任。 |
-
-## ProtectedResourceType9+枚举说明
-
-| 名称 | 描述 | 备注 |
-| --------- | ------------- | -------------------------- |
-| MidiSysex | MIDI SYSEX资源。 | 目前仅支持权限事件上报,MIDI设备的使用还未支持。 |
+| 名称 | 描述 | 备注 |
+| --------- | ------------- | -------------------------- |
+| MidiSysex | MIDI SYSEX资源。 | 目前仅支持权限事件上报,MIDI设备的使用还未支持。 |
## WebDarkMode9+枚举说明
| 名称 | 描述 |
@@ -6176,103 +5424,6 @@ onSslErrorEventReceive接口返回的SSL错误的具体原因。
| On | Web深色模式开启。 |
| Auto | Web深色模式跟随系统。 |
-## WebAsyncController
-
-通过WebAsyncController可以控制Web组件具有异步回调通知的行为,一个WebAsyncController对象控制一个Web组件。
-
-### 创建对象
-
-```
-webController: WebController = new WebController();
-webAsyncController: WebAsyncController = new WebAsyncController(webController);
-```
-
-### storeWebArchive9+
-
-storeWebArchive(baseName: string, autoName: boolean, callback: AsyncCallback): void
-
-以回调方式异步保存当前页面。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| -------- | ---------------------------------------- | ---- | ----------------------------------- |
-| baseName | string | 是 | 文件存储路径,该值不能为空。
-| autoName | boolean | 是 | 决定是否自动生成文件名。
如果为false,则将baseName作为文件存储路径。
如果为true,则假定baseName是一个目录,将根据当前页的Url自动生成文件名。
-| callback | AsyncCallback | 是 | 返回文件存储路径,保持网页失败会返回null。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController()
- build() {
- Column() {
- Button('saveWebArchive')
- .onClick(() => {
- let webAsyncController = new web_webview.WebAsyncController(this.controller)
- webAsyncController.storeWebArchive("/data/storage/el2/base/", true, (filename) => {
- if (filename != null) {
- console.info(`save web archive success: ${filename}`)
- }
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
-### storeWebArchive9+
-
-storeWebArchive(baseName: string, autoName: boolean): Promise
-
-以Promise方式异步保存当前页面。
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 说明 |
-| -------- | ---------------------------------------- | ---- | ----------------------------------- |
-| baseName | string | 是 | 文件存储路径,该值不能为空。
-| autoName | boolean | 是 | 决定是否自动生成文件名。
如果为false,则将baseName作为文件存储路径。
如果为true,则假定baseName是一个目录,将根据当前页的Url自动生成文件名。
-
-**返回值:**
-
-| 类型 | 说明 |
-| --------------- | -------------------------------- |
-| Promise | Promise实例,保存成功返回文件路径,保存失败返回null。 |
-
-**示例:**
-
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
- @Entry
- @Component
- struct WebComponent {
- controller: WebController = new WebController();
- build() {
- Column() {
- Button('saveWebArchive')
- .onClick(() => {
- let webAsyncController = new web_webview.WebAsyncController(this.controller);
- webAsyncController.storeWebArchive("/data/storage/el2/base/", true)
- .then(filename => {
- if (filename != null) {
- console.info(`save web archive success: ${filename}`)
- }
- })
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
-
## WebMessagePort9+
通过WebMessagePort可以进行消息的发送以及接收。