/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @kit ArkWeb */ /*** if arkts 1.2 */ import { Resource } from './global/resource'; /*** endif */ import { AsyncCallback, BusinessError } from './@ohos.base'; import { Callback } from './@ohos.base'; /*** if arkts 1.1 */ import cert from './@ohos.security.cert'; import image from './@ohos.multimedia.image'; import type print from './@ohos.print'; import { WebNetErrorList } from './@ohos.web.netErrorList'; /*** endif */ /** * This module provides the capability to manage web modules. * * @namespace webview * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * This module provides the capability to manage web modules. * * @namespace webview * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @since 10 */ /** * This module provides the capability to manage web modules. * * @namespace webview * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ declare namespace webview { /** * Defines the Web's request/response header. * * @interface WebHeader * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Defines the Web's request/response header. * * @interface WebHeader * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @since 10 */ /** * Defines the Web's request/response header. * * @interface WebHeader * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ /** * Defines the Web's request/response header. * * @typedef WebHeader * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ interface WebHeader { /** * Gets the key of the request/response header. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Gets the key of the request/response header. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @since 10 */ /** * Gets the key of the request/response header. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ headerKey: string; /** * Gets the value of the request/response header. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Gets the value of the request/response header. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @since 10 */ /** * Gets the value of the request/response header. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ headerValue: string; } /** * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ enum WebHitTestType { /** * The edit text. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * The edit text. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ EditText, /** * The email address. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * The email address. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ Email, /** * The HTML::a tag with src=http. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * The HTML::a tag with src=http. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ HttpAnchor, /** * The HTML::a tag with src=http + HTML::img. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * The HTML::a tag with src=http + HTML::img. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ HttpAnchorImg, /** * The HTML::img tag. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * The HTML::img tag. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ Img, /** * The map address. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * The map address. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ Map, /** * The phone number. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * The phone number. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ Phone, /** * Other unknown HitTest. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Other unknown HitTest. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ Unknown } /** * Defines the mode for using HttpDns. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Defines the mode for using HttpDns. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ enum SecureDnsMode { /** * Do not use HttpDns, can be used to revoke previously used HttpDns configuration. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Do not use HttpDns, can be used to revoke previously used HttpDns configuration. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ OFF = 0, /** * By default, the user-settings of HttpDns is used for dns resolution, and if it fails, * the system dns is used for resolution. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * By default, the user-settings of HttpDns is used for dns resolution, and if it fails, * the system dns is used for resolution. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ AUTO = 1, /** * Use the user-settings of HttpDns for dns resolution. If it fails, it will not * fall back to the system dns, which will directly cause the page to fail to load. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Use the user-settings of HttpDns for dns resolution. If it fails, it will not * fall back to the system dns, which will directly cause the page to fail to load. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ SECURE_ONLY = 2, } /** * Enum type for ArkWeb Engine Version. * * ArkWeb Dual Web Engine Versioning Convention: *

See [ArkWeb Dual Web Engine Versioning Convention] for switching between Legacy and Evergreen Web Engine. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @since 20 */ enum ArkWebEngineVersion { /** * Use the system default ArkWeb engine. * @syscap SystemCapability.Web.Webview.Core * @since 20 */ SYSTEM_DEFAULT = 0, /** * ArkWeb M114 version. * @syscap SystemCapability.Web.Webview.Core * @since 20 */ M114 = 1, /** * ArkWeb M132 version. * @syscap SystemCapability.Web.Webview.Core * @since 20 */ M132 = 2, } /** * Defines the security level for the page. * * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ enum SecurityLevel { /** * Unable to determine whether it is safe or not, the non-http/https protocol used. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ NONE = 0, /** * Indicates the HTTPS protocol used by the page and the authentication is successful. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ SECURE = 1, /** * The page is insecure. For example, the HTTP protocol is used or the HTTPS protocol * is used but use an legacy TLS version. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ WARNING = 2, /** * Attempted HTTPS and failed, the authentication is failed. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ DANGEROUS = 3, } /** * The playback status of all audio and video. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ enum MediaPlaybackState { /** * No audio or video currently. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ NONE = 0, /** * The audio and video on the page are being played. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ PLAYING = 1, /** * The audio and video on the page are paused. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ PAUSED = 2, /** * The audio and video on the page are stopped. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ STOPPED = 3 } /** * The memory pressure level that can be set. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ enum PressureLevel { /** * Modules are advised to free buffers that are cheap to re-allocate and not immediately needed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ MEMORY_PRESSURE_LEVEL_MODERATE = 1, /** * At this level, modules are advised to free all possible memory. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ MEMORY_PRESSURE_LEVEL_CRITICAL = 2 } /** * Defines the hit test value, related to {@link getHitTestValue} method. * * @interface HitTestValue * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Defines the hit test value, related to {@link getHitTestValue} method. * * @interface HitTestValue * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Provides element information of the click area. related to {@link getLastHitTest} method. * * @typedef HitTestValue * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ interface HitTestValue { /** * Get the hit test type. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get the hit test type. * * @type { WebHitTestType } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ type: WebHitTestType; /** * Get the hit test extra data. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get the hit test extra data. * If the clicked area is an image or a link, the additional parameter information is it's URL address. * * @type { string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ extra: string; } /** * Defines the configuration of web custom scheme, related to {@link customizeSchemes} method. * * @interface WebCustomScheme * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Defines the configuration of web custom scheme, related to {@link customizeSchemes} method. * * @interface WebCustomScheme * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Defines the configuration of web custom scheme, related to {@link customizeSchemes} method. * * @typedef WebCustomScheme * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ interface WebCustomScheme { /** * Name of the custom scheme. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Name of the custom scheme. * * @type { string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ schemeName: string; /** * Whether Cross-Origin Resource Sharing is supported. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Whether Cross-Origin Resource Sharing is supported. * * @type { boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ isSupportCORS: boolean; /** * Whether fetch request is supported. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Whether fetch request is supported. * * @type { boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ isSupportFetch: boolean; /** * If isStandard is true, the scheme will be handled as a standard scheme. The standard * schemes needs to comply with the URL normalization and parsing rules defined in Section 3.1 of RFC 1738, * which can be found in the http://www.ietf.org/rfc/rfc1738.txt. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ isStandard?: boolean; /** * If isLocal is true, the same security rules as those applied to the "file" URL will be * used to handle the scheme. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ isLocal?: boolean; /** * If isDisplayIsolated is true, then the scheme can only be displayed from other content * hosted using the same scheme. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ isDisplayIsolated?: boolean; /** * If isSecure is true, the same security rules as those applied to the "https" URL will be * used to handle the scheme. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ isSecure?: boolean; /** * If isCspBypassing is true, then this scheme can bypass Content Security Policy (CSP) * checks. In most cases, this value should not be true when isStandard is true. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ isCspBypassing?: boolean; /** * If isCodeCacheSupported is true, then the js of this scheme can generate code cache. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @since 12 */ isCodeCacheSupported?: boolean; } /** * Defines the callback of createPdf, related to {@link createPDF} method. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ class PdfData { /** * Return the data stream generated by the webpage. * * @returns { Uint8Array } return pdf data. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ pdfArrayBuffer(): Uint8Array; } /** * Defines the configuration of creating pdf, related to {@Link createPdf} method. * * @typedef PdfConfiguration * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ interface PdfConfiguration { /** * Number of the width. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ width: number; /** * Number of the height. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ height: number; /** * Number of the marginTop. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ marginTop: number; /** * Number of the marginBottom. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ marginBottom: number; /** * Number of the marginRight. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ marginRight: number; /** * Number of the marginLeft. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ marginLeft: number; /** * Number of the scaling. * * @type { ?number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ scale?: number; /** * Whether background should be printed when creating pdf. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 14 */ shouldPrintBackground?: boolean; } /** * Provides basic information of web storage. * * @interface WebStorageOrigin * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Provides basic information of web storage. * * @interface WebStorageOrigin * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Provides basic information of web storage. * * @typedef WebStorageOrigin * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ /** * Provides basic information of web storage. * * @typedef WebStorageOrigin * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ interface WebStorageOrigin { /** * Url source. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Url source. * * @type { string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Url source. * * @type { string } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ origin: string; /** * Specify the amount of storage for the source. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Specify the amount of storage for the source. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Specify the amount of storage for the source. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ usage: number; /** * the callback of getOriginUsage. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * the callback of getOriginUsage. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * the callback of getOriginUsage. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ quota: number; } /** * Defines the Web's request info. * * @typedef RequestInfo * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ interface RequestInfo { /** * Gets the url of the request. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ url: string; /** * Gets the method of the request. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ method: string; /** * Gets the form data of the request. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ formData: string; } /** * Defines the scroll offset of the webpage in view port, the unit is virtual pixel. * Related to {@link getScrollOffset} method. * * @typedef ScrollOffset * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 13 */ interface ScrollOffset { /** * The horizontal scroll offset of the web page. The value is the difference between * the x-coordinate of the left border of the web page and the x-coordinate of the * left border of the Web component. When the web page scrolls to the right, * the value range is negative. * When the web page is not over-scrolled or the web page is over-scrolled to the left, * the value is 0 or a positive value. Unit: vp. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 13 */ x: number; /** * The vertical scroll offset of the web page. The value is the difference between * the y-coordinate of the upper border of the web page and the y-coordinate of the * upper boundary of the Web component. When the web page is scrolled down, * the value range is negative. * When the web page is not over-scrolled or the web page is over-scrolled to the up, * the value is 0 or a positive value. Unit: vp. * * @type { number } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 13 */ y: number; } /** * Subscribe to a callback of a specified type of web event once. * * @param {string} type Types of web event. * @param {Callback} callback Indicate callback used to receive the web event. * * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Subscribe to a callback of a specified type of web event once. * * @param {string} type Types of web event. * @param {Callback} callback Indicate callback used to receive the web event. * * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ function once(type: string, callback: Callback): void; /** * Provides methods for managing web storage.3 * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Provides methods for managing web storage.3 * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Implements a WebStorage object to manage the Web SQL database and HTML5 Web Storage APIs. * All Web components in an application share a WebStorage object. * *

API Note:
* You must load the Web component before calling the APIs in WebStorage. *

* * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ class WebStorage { /** * Delete all the storage data. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Delete all the storage data. * * @param { boolean } incognito - {@code true} delete all the storage data in incognito mode; * {@code false} otherwise. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Deletes all data in the Web SQL Database. * * @param { boolean } incognito - Whether to delete all data in the Web SQL Database in incognito mode. * {@code true} means to delete all data in the Web SQL Database in incognito mode; * {@code false} means to delete all data in the Web SQL Database in normal non-incognito mode. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static deleteAllData(incognito?: boolean): void; /** * Delete the storage data with the origin. * * @param { string } origin - The origin which to be deleted. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Delete the storage data with the origin. * * @param { string } origin - The origin which to be deleted. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Deletes all data in the specified origin. * * @param { string } origin - Index of the origin, which is obtained through {@link getOrigins}. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static deleteOrigin(origin: string): void; /** * Get current all the web storage origins. * @returns { Promise> } - returns all the WebStorageOrigin. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100012 - Invalid web storage origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get current all the web storage origins. * @returns { Promise> } - returns all the WebStorageOrigin. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100012 - Invalid web storage origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Obtains information about all origins that are currently using the Web SQL Database. * This API uses a promise to return the result. * * @returns { Promise> } - Promise used to return the information about the origins. * For details, see {@link WebStorageOrigin}. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100012 - Invalid web storage origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static getOrigins(): Promise>; /** * Get current all the web storage origins. * @param { AsyncCallback> } callback - callback used to return all the WebStorageOrigin. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100012 - Invalid web storage origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get current all the web storage origins. * @param { AsyncCallback> } callback - callback used to return all the WebStorageOrigin. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100012 - Invalid web storage origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Obtains information about all origins that are currently using the Web SQL Database. * This API uses an asynchronous callback to return the result. * * @param { AsyncCallback> } callback - Callback used to return the information about the * origins. For details, see {@link WebStorageOrigin}. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100012 - Invalid web storage origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static getOrigins(callback: AsyncCallback>): void; /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. * @returns { Promise } - the promise returned by the function * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. * @returns { Promise } - the promise returned by the function * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. * @returns { Promise } - the promise returned by the function * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static getOriginQuota(origin: string): Promise; /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. * @param { AsyncCallback } callback - the callback of getOriginQuota. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. * @param { AsyncCallback } callback - the callback of getOriginQuota. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. * @param { AsyncCallback } callback - the callback of getOriginQuota. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static getOriginQuota(origin: string, callback: AsyncCallback): void; /** * Get the web amount of storage with the origin. * @param { string } origin - The origin which to be inquired. * @returns { Promise } - the promise returned by the function * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get the web amount of storage with the origin. * @param { string } origin - The origin which to be inquired. * @returns { Promise } - the promise returned by the function * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the web amount of storage with the origin. * @param { string } origin - The origin which to be inquired. * @returns { Promise } - the promise returned by the function * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static getOriginUsage(origin: string): Promise; /** * Get the web amount of storage with the origin. * @param { string } origin - The origin which to be inquired. * @param { AsyncCallback } callback - the callback of getOriginUsage. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get the web amount of storage with the origin. * @param { string } origin - The origin which to be inquired. * @param { AsyncCallback } callback - the callback of getOriginUsage. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the web amount of storage with the origin. * @param { string } origin - The origin which to be inquired. * @param { AsyncCallback } callback - the callback of getOriginUsage. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ static getOriginUsage(origin: string, callback: AsyncCallback): void; } /** * Provides methods for managing web database. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Implements a WebDataBase object. * *

API Note:
* You must load the Web component before calling the APIs in WebDataBase. *

* * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ class WebDataBase { /** * Get whether instances holds any http authentication credentials. * @returns { boolean } true if instances saved any http authentication credentials otherwise false. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get whether instances holds any http authentication credentials. * @returns { boolean } true if instances saved any http authentication credentials otherwise false. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static existHttpAuthCredentials(): boolean; /** * Delete all http authentication credentials. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Deletes all HTTP authentication credentials saved in the cache. This API returns the result synchronously. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static deleteHttpAuthCredentials(): void; /** * Get http authentication credentials. * @param { string } host - The host to which the credentials apply. * @param { string } realm - The realm to which the credentials apply. * @returns { Array } Return an array containing username and password. * @throws { BusinessError } 401 - Invalid input parameter. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get http authentication credentials. * @param { string } host - The host to which the credentials apply. * @param { string } realm - The realm to which the credentials apply. * @returns { Array } Return an array containing username and password. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static getHttpAuthCredentials(host: string, realm: string): Array; /** * Save http authentication credentials. * @param { string } host - The host to which the credentials apply. * @param { string } realm - The realm to which the credentials apply. * @param { string } username - The username. * @param { string } password - The password. * @throws { BusinessError } 401 - Invalid input parameter. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Saves HTTP authentication credentials for a given host and realm. This API returns the result synchronously. * @param { string } host - Host to which HTTP authentication credentials apply. * @param { string } realm - Realm to which HTTP authentication credentials apply. * @param { string } username - User name. * @param { string } password - Password. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void; } /** * Provides a method for managing web geographic location permissions. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Provides a method for managing web geographic location permissions. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Implements a GeolocationPermissions object. * *

API Note:
* You must load the Web component before calling the APIs in GeolocationPermissions. *

* * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ class GeolocationPermissions { /** * Allow geolocation permissions for specifies source. * @param { string } origin - Url source. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Allow geolocation permissions for specifies source. * @param { string } origin - Url source. * @param { boolean } incognito - {@code true} Allow geolocation permissions for specifies source * in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Allows the specified origin to use the geolocation information. * @param { string } origin - Index of the origin. * @param { boolean } incognito - Whether to allow the specified origin to use the geolocation information * in incognito mode. {@code true} means to allow the specified origin to use the * geolocation information in incognito mode; {@code false} means to allow the * specified origin to use the geolocation information in normal non-incognito mode. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static allowGeolocation(origin: string, incognito?: boolean): void; /** * Delete geolocation permissions for specifies source. * @param { string } origin - Url source. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Delete geolocation permissions for specifies source. * @param { string } origin - Url source. * @param { boolean } incognito - {@code true} delete geolocation permissions for specifies source * in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Delete geolocation permissions for specifies source. * @param { string } origin - Url source. * @param { boolean } incognito - {@code true} delete geolocation permissions for specifies source * in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static deleteGeolocation(origin: string, incognito?: boolean): void; /** * Delete all geolocation permissions. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Delete all geolocation permissions. * * @param { boolean } incognito - {@code true} delete all geolocation in incognito mode; * {@code false} otherwise. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Clears the geolocation permission status of all sources. * * @param { boolean } incognito - Whether to clear the geolocation permission status of all sources in incognito * mode. {@code true} means to clear the geolocation permission status of * all sources in incognito mode; {@code false} means to clear the geolocation * permission status of all sources in normal non-incognito mode. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static deleteAllGeolocation(incognito?: boolean): void; /** * Gets the geolocation permission status of the specified source. * @param { string } origin - Url source. * @returns { Promise } A Promise instance that obtains the permission * status of the specified source and obtains successfully, * true for authorization, false for access denial. Failed * to get, indicating that the permission status of the * specified source does not exist. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Gets the geolocation permission status of the specified source. * @param { string } origin - Url source. * @param { boolean } incognito - {@code true} gets the geolocation permission status of the * specified source in incognito mode; {@code false} otherwise. * @returns { Promise } A Promise instance that obtains the permission * status of the specified source and obtains successfully, * true for authorization, false for access denial. Failed * to get, indicating that the permission status of the * specified source does not exist. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Gets the geolocation permission status of the specified source. * @param { string } origin - Url source. * @param { boolean } incognito - {@code true} gets the geolocation permission status of the * specified source in incognito mode; {@code false} otherwise. * @returns { Promise } A Promise instance that obtains the permission * status of the specified source and obtains successfully, * true for authorization, false for access denial. Failed * to get, indicating that the permission status of the * specified source does not exist. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static getAccessibleGeolocation(origin: string, incognito?: boolean): Promise; /** * Gets the geolocation permission status of the specified source. * @param { string } origin - Url source. * @param { AsyncCallback } callback - Returns the geolocation permission status for * the specified source. Successful acquisition, * true means authorized, false means access is * denied. Failed to get, indicating that the * permission status of the specified source does * not exist. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Gets the geolocation permission status of the specified source. * @param { string } origin - Url source. * @param { AsyncCallback } callback - Returns the geolocation permission status for * the specified source. Successful acquisition, * true means authorized, false means access is * denied. Failed to get, indicating that the * permission status of the specified source does * not exist. * @param { boolean } incognito - {@code true} gets the geolocation permission status of the * specified source in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Gets the geolocation permission status of the specified source. * @param { string } origin - Url source. * @param { AsyncCallback } callback - Returns the geolocation permission status for * the specified source. Successful acquisition, * true means authorized, false means access is * denied. Failed to get, indicating that the * permission status of the specified source does * not exist. * @param { boolean } incognito - {@code true} gets the geolocation permission status of the * specified source in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100011 - Invalid origin. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static getAccessibleGeolocation(origin: string, callback: AsyncCallback, incognito?: boolean): void; /** * Get all stored geolocation permission url source. * * @returns { Promise> } A Promise instance that gets all source information about * the stored geolocation permission state. * @throws { BusinessError } 401 - Invalid input parameter. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get all stored geolocation permission url source. * @param { boolean } incognito - {@code true} get all stored geolocation permission url source * in incognito mode; {@code false} otherwise. * @returns { Promise> } A Promise instance that gets all source information about * the stored geolocation permission state. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get all stored geolocation permission url source. * @param { boolean } incognito - {@code true} get all stored geolocation permission url source * in incognito mode; {@code false} otherwise. * @returns { Promise> } A Promise instance that gets all source information about * the stored geolocation permission state. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static getStoredGeolocation(incognito?: boolean): Promise>; /** * Get all stored geolocation permission url source. * @param { AsyncCallback> } callback - Returns all source information for * stored geolocation permission states. * @throws { BusinessError } 401 - Invalid input parameter. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get all stored geolocation permission url source. * @param { AsyncCallback> } callback - Returns all source information for * stored geolocation permission states. * @param { boolean } incognito - {@code true} gets all stored geolocation permission url * source in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get all stored geolocation permission url source. * @param { AsyncCallback> } callback - Returns all source information for * stored geolocation permission states. * @param { boolean } incognito - {@code true} gets all stored geolocation permission url * source in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static getStoredGeolocation(callback: AsyncCallback>, incognito?: boolean): void; } /** * Provides methods for managing the web cookies. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Provides methods for managing the web cookies. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ class WebCookieManager { /** * Gets all cookies for the given URL. * * @param { string } url - The URL for which the cookies are requested. * @returns { string } - The cookie value for the given URL. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @syscap SystemCapability.Web.Webview.Core * @since 9 * @deprecated since 11 * @useinstead ohos.web.webview.WebCookieManager#fetchCookieSync */ static getCookie(url: string): string; /** * Gets all cookies for the given URL. * * @param { string } url - The URL for which the cookies are requested. * @param { boolean } incognito - {@code true} gets all cookies for the given URL * in incognito mode; {@code false} otherwise. * @returns { string } - The cookie value for the given URL. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static fetchCookieSync(url: string, incognito?: boolean): string; /** * Gets all cookies for the given URL Asynchronously. * * @param { string } url - The URL for which the cookies are requested. * @returns { Promise } - A promise resolved after the cookies of given URL have been gotten. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static fetchCookie(url: string): Promise; /** * Gets all cookies for the given URL Asynchronously. * * @param { string } url - The URL for which the cookies are requested. * @param { boolean } incognito - {@code true} gets all cookies for the given URL * in incognito mode; {@code false} otherwise. * @returns { Promise } - A promise resolved after the cookies of given URL have been gotten. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @syscap SystemCapability.Web.Webview.Core * @since 14 */ static fetchCookie(url: string, incognito: boolean): Promise; /** * Gets all cookies for the given URL Asynchronously. * * @param { string } url - The URL for which the cookies are requested. * @param { AsyncCallback } callback - Called after the cookies of given URL have been gotten. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static fetchCookie(url: string, callback: AsyncCallback): void; /** * Set a single cookie (key-value pair) for the given URL. * * @param { string } url - The URL for which the cookie is to be set. * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @throws { BusinessError } 17100005 - The provided cookie value is invalid. It must follow the format specified *
in RFC 6265. * @syscap SystemCapability.Web.Webview.Core * @since 9 * @deprecated since 11 * @useinstead ohos.web.webview.WebCookieManager#configCookieSync */ static setCookie(url: string, value: string): void; /** * Set a single cookie (key-value pair) for the given URL. * * @param { string } url - The URL for which the cookie is to be set. * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. * @param { boolean } incognito - {@code true} set a single cookie (key-value pair) for the given URL * in incognito mode; {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @throws { BusinessError } 17100005 - The provided cookie value is invalid. It must follow the format specified *
in RFC 6265. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static configCookieSync(url: string, value: string, incognito?: boolean): void; /** * Set a single cookie (key-value pair) for the given URL. * * @param { string } url - The URL for which the cookie is to be set. * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. * @param { boolean } incognito - {@code true} set a single cookie (key-value pair) for the given URL * in incognito mode; {@code false} otherwise. * @param { boolean } includeHttpOnly - {@code true} HTTP-only cookies can also be overwritten; * {@code false} otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @throws { BusinessError } 17100005 - The provided cookie value is invalid. It must follow the format specified *
in RFC 6265. * @syscap SystemCapability.Web.Webview.Core * @since 14 */ static configCookieSync(url: string, value: string, incognito: boolean, includeHttpOnly: boolean): void; /** * Set a single cookie (key-value pair) for the given URL Asynchronously. * * @param { string } url - The URL for which the cookie is to be set. * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. * @returns { Promise } - A promise resolved after the cookies of given URL have been set. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @throws { BusinessError } 17100005 - The provided cookie value is invalid. It must follow the format specified *
in RFC 6265. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static configCookie(url: string, value: string): Promise; /** * Set a single cookie (key-value pair) for the given URL Asynchronously. * * @param { string } url - The URL for which the cookie is to be set. * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. * @param { boolean } incognito - {@code true} set a single cookie (key-value pair) for the given URL * in incognito mode; {@code false} otherwise. * @param { boolean } includeHttpOnly - {@code true} HTTP-only cookies can also be overwritten; * {@code false} otherwise. * @returns { Promise } - A promise resolved after the cookies of given URL have been set. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @throws { BusinessError } 17100005 - The provided cookie value is invalid. It must follow the format specified *
in RFC 6265. * @syscap SystemCapability.Web.Webview.Core * @since 14 */ static configCookie(url: string, value: string, incognito: boolean, includeHttpOnly: boolean): Promise; /** * Set a single cookie (key-value pair) for the given URL Asynchronously. * * @param { string } url - The URL for which the cookie is to be set. * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. * @param { AsyncCallback } callback - Called after the cookies have been set. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @throws { BusinessError } 17100002 - URL error. No valid cookie found for the specified URL. * @throws { BusinessError } 17100005 - The provided cookie value is invalid. It must follow the format specified *
in RFC 6265. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static configCookie(url: string, value: string, callback: AsyncCallback): void; /** * Save the cookies synchronously. * @syscap SystemCapability.Web.Webview.Core * @since 15 */ static saveCookieSync(): void; /** * Save the cookies Asynchronously. * @returns { Promise } - A promise resolved after the cookies have been saved. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Save the cookies Asynchronously. * @returns { Promise } - A promise resolved after the cookies have been saved. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static saveCookieAsync(): Promise; /** * Save the cookies Asynchronously. * @param { AsyncCallback } callback - Called after the cookies have been saved. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Save the cookies Asynchronously. * @param { AsyncCallback } callback - Called after the cookies have been saved. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static saveCookieAsync(callback: AsyncCallback): void; /** * Get whether the instance can send and accept cookies. * * @returns { boolean } True if the instance can send and accept cookies else false. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get whether the instance can send and accept cookies. * * @returns { boolean } True if the instance can send and accept cookies else false. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static isCookieAllowed(): boolean; /** * Set whether the instance should send and accept cookies. * By default this is set to be true. * * @param { boolean } accept - Whether the instance should send and accept cookies. * @throws { BusinessError } 401 - Invalid input parameter. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Set whether the instance should send and accept cookies. * By default this is set to be true. * * @param { boolean } accept - Whether the instance should send and accept cookies. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static putAcceptCookieEnabled(accept: boolean): void; /** * Get whether the instance can send and accept thirdparty cookies. * * @returns { boolean } True if the instance can send and accept thirdparty cookies else false. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get whether the instance can send and accept thirdparty cookies. * * @returns { boolean } True if the instance can send and accept thirdparty cookies else false. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static isThirdPartyCookieAllowed(): boolean; /** * Set whether the instance should send and accept thirdparty cookies. * By default this is set to be false. * * @param { boolean } accept - Whether the instance should send and accept thirdparty cookies. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Set whether the instance should send and accept thirdparty cookies. * By default this is set to be false. * * @param { boolean } accept - Whether the instance should send and accept thirdparty cookies. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static putAcceptThirdPartyCookieEnabled(accept: boolean): void; /** * Check whether exists any cookies. * * @returns { boolean } True if exists more than one cookie else false; * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Check whether exists any cookies. * * @param { boolean } incognito - {@code true} check whether exists any cookies. * in incognito mode; {@code false} otherwise. * @returns { boolean } True if exists more than one cookie else false; * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Check whether exists any cookies. * * @param { boolean } incognito - {@code true} check whether exists any cookies. * in incognito mode; {@code false} otherwise. * @returns { boolean } True if exists more than one cookie else false; * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static existCookie(incognito?: boolean): boolean; /** * Remove all cookies. * @syscap SystemCapability.Web.Webview.Core * @since 9 * @deprecated since 11 * @useinstead ohos.web.webview.WebCookieManager#clearAllCookiesSync */ static deleteEntireCookie(): void; /** * Remove all cookies. * * @param { boolean } incognito - {@code true} remove all cookies in incognito mode; * {@code false} otherwise. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static clearAllCookiesSync(incognito?: boolean): void; /** * Remove all cookies Asynchronously. * @returns { Promise } - A promise resolved after the cookies have been deleted. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static clearAllCookies(): Promise; /** * Remove all cookies Asynchronously. * @param { AsyncCallback } callback - Called after the cookies have been deleted. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ static clearAllCookies(callback: AsyncCallback): void; /** * Delete the session cookies. * @syscap SystemCapability.Web.Webview.Core * @since 9 * @deprecated since 11 * @useinstead ohos.web.webview.WebCookieManager#clearSessionCookieSync */ static deleteSessionCookie(): void; /** * Delete the session cookies. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static clearSessionCookieSync(): void; /** * Delete the session cookies Asynchronously. * @returns { Promise } - A promise resolved after the cookies have been deleted. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ static clearSessionCookie(): Promise; /** * Delete the session cookies Asynchronously. * @param { AsyncCallback } callback - Called after the cookies have been deleted. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Delete the session cookies Asynchronously. * @param { AsyncCallback } callback - Called after the cookies have been deleted. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ static clearSessionCookie(callback: AsyncCallback): void; } /** * Enum type supplied to {@link onMessageEventExt} for indicating the type of web message. * * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Enum type supplied to {@link onMessageEventExt} for indicating the type of web message. * * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Enum type supplied to {@link onMessageEventExt} for indicating the type of web message. * * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ enum WebMessageType { /** * Unsupported data type. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Unsupported data type. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ NOT_SUPPORT, /** * The string data type. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The string data type. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The string data type. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ STRING, /** * The number data type. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The number data type. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The number data type. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ NUMBER, /** * The boolean data type. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The boolean data type. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The boolean data type. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ BOOLEAN, /** * The arraybuffer data type. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The arraybuffer data type. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ ARRAY_BUFFER, /** * The array data type. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The array data type. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The array data type. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ ARRAY, /** * The error data type. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The error data type. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The error data type. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ ERROR } /** * The message received or sent from web message port. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The message received or sent from web message port. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The message received or sent from web message port. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ class WebMessageExt { /** * Get the type of the web message. * @returns { WebMessageType } - Returns data of WebMessageType type * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the type of the web message. * @returns { WebMessageType } - Returns data of WebMessageType type * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the type of the web message. * @returns { WebMessageType } - Returns data of WebMessageType type * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getType(): WebMessageType; /** * Get the string value of the web message. * @returns { string } - Returns data of string type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the string value of the web message. * @returns { string } - Returns data of string type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the string value of the web message. * @returns { string } - Returns data of string type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getString(): string; /** * Get the number value of the web message. * @returns { number } - Returns data of number type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the number value of the web message. * @returns { number } - Returns data of number type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the number value of the web message. * @returns { number } - Returns data of number type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getNumber(): number; /** * Get the boolean value of the web message. * @returns { boolean } - Returns data of Boolean type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the boolean value of the web message. * @returns { boolean } - Returns data of Boolean type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the boolean value of the web message. * @returns { boolean } - Returns data of Boolean type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getBoolean(): boolean; /** * Get the array buffer value of the web message. * @returns { ArrayBuffer } - Returns data of ArrayBuffer type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the array buffer value of the web message. * @returns { ArrayBuffer } - Returns data of ArrayBuffer type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ getArrayBuffer(): ArrayBuffer; /** * Get the array value of the web message. * @returns { Array } - Returns data of Array type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the array value of the web message. * @returns { Array } - Returns data of Array type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the array value of the web message. * @returns { Array } - Returns data of Array type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getArray(): Array; /** * Get the error value of the web message. * @returns { Error } - Returns data of Error type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the error value of the web message. * @returns { Error } - Returns data of Error type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the error value of the web message. * @returns { Error } - Returns data of Error type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getError(): Error; /** * Set the type of the web message. * @param { WebMessageType } type - set WebMessageType type data * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Set the type of the web message. * @param { WebMessageType } type - set WebMessageType type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Set the type of the web message. * @param { WebMessageType } type - set WebMessageType type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ setType(type: WebMessageType): void; /** * Set the string value of the web message. * @param { string } message - set string type data * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Set the string value of the web message. * @param { string } message - set string type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Set the string value of the web message. * @param { string } message - set string type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ setString(message: string): void; /** * Set the number value of the web message. * @param { number } message - set number type data * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Set the number value of the web message. * @param { number } message - set number type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Set the number value of the web message. * @param { number } message - set number type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ setNumber(message: number): void; /** * Set the boolean value of the web message. * @param { boolean } message - set boolean type data * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Set the boolean value of the web message. * @param { boolean } message - set boolean type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Set the boolean value of the web message. * @param { boolean } message - set boolean type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ setBoolean(message: boolean): void; /** * Set the array buffer value of the web message. * @param { ArrayBuffer } message - set ArrayBuffer type data * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Set the array buffer value of the web message. * @param { ArrayBuffer } message - set ArrayBuffer type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ setArrayBuffer(message: ArrayBuffer): void; /** * Set the array value of the web message. * @param { Array } message - set Array type data * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Set the array value of the web message. * @param { Array } message - set Array type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Set the array value of the web message. * @param { Array } message - set Array type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ setArray(message: Array): void; /** * Set the error value of the web message. * @param { Error } message - set Error type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Set the error value of the web message. * @param { Error } message - set Error type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Set the error value of the web message. * @param { Error } message - set Error type data * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100014 - The type and value of the message do not match. * * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ setError(message: Error): void; } /** * WebMessage type supplied to {@link onMessageEventExt} for indicating the type of web message. * * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * WebMessage type supplied to {@link onMessageEventExt} for indicating the type of web message. * * @typedef { ArrayBuffer | string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ type WebMessage = ArrayBuffer | string; /** * Define html web message port. * @interface WebMessagePort * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Define html web message port. * @interface WebMessagePort * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ /** * Define html web message port. * @typedef WebMessagePort * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 12 */ interface WebMessagePort { /** * The flag indicates whether more formats are supported than string and array buffers. * * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The flag indicates whether more formats are supported than string and array buffers. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ isExtentionType?: boolean; /** * Close port. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Close port. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ close(): void; /** * Post a message to other port. * @param { WebMessage } message - Message to send. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100010 - Failed to post messages through the port. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Post a message to other port. * @param { WebMessage } message - Message to send. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100010 - Failed to post messages through the port. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ postMessageEvent(message: WebMessage): void; /** * Receive message from other port. * @param { function } callback - Callback function for receiving messages. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100006 - Failed to register a message event for the port. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Receive message from other port. * @param { function } callback - Callback function for receiving messages. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100006 - Failed to register a message event for the port. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ onMessageEvent(callback: (result: WebMessage) => void): void; /** * Post a message to other port. * @param { WebMessageExt } message - Message to send. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100010 - Failed to post messages through the port. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Post a message to other port. * @param { WebMessageExt } message - Message to send. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100010 - Failed to post messages through the port. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Post a message to other port. * @param { WebMessageExt } message - Message to send. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100010 - Failed to post messages through the port. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ postMessageEventExt(message: WebMessageExt): void; /** * Receive message from other port. * @param { function } callback - Callback function for receiving messages. * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100006 - Failed to register a message event for the port. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Receive message from other port. * @param { function } callback - Callback function for receiving messages. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100006 - Failed to register a message event for the port. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Receive message from other port. * @param { function } callback - Callback function for receiving messages. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 17100006 - Failed to register a message event for the port. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ onMessageEventExt(callback: (result: WebMessageExt) => void): void; } /** * Provides information for history item in BackForwardList. * @interface HistoryItem * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Provides information for history item in BackForwardList. * @interface HistoryItem * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ /** * Provides information for history item in BackForwardList. * @typedef HistoryItem * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 12 */ interface HistoryItem { /** * Pixelmap of icon. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Pixelmap of icon. * @type { image.PixelMap } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ icon: image.PixelMap; /** * Url of this history item. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Url of this history item. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ historyUrl: string; /** * Original request url of this history item. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Original request url of this history item. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ historyRawUrl: string; /** * Title of this history item. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Title of this history item. * @type { string } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ title: string; } /** * Provides back and forward history list information method. related to {@link HistoryItem}. * @interface BackForwardList * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Provides back and forward history list information method. related to {@link HistoryItem}. * @interface BackForwardList * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ /** * Provides back and forward history list information method. related to {@link HistoryItem}. * @typedef BackForwardList * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 12 */ interface BackForwardList { /** * Current index in BackForwardList. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Current index in BackForwardList. * @type { number } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ currentIndex: number; /** * Size of in BackForwardList. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Size of in BackForwardList. * @type { number } * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ size: number; /** * Get history entry at given index. * * @param { number } index Index of back forward list entry. * @returns { HistoryItem } HistoryItem at given index in back forward list. * @throws { BusinessError } 401 - Invalid input parameter. * @syscap SystemCapability.Web.Webview.Core * @since 9 */ /** * Get history entry at given index. * * @param { number } index Index of back forward list entry. * @returns { HistoryItem } HistoryItem at given index in back forward list. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 11 */ getItemAtIndex(index: number): HistoryItem; } /** * Defines the snapshot info. * * @typedef SnapshotInfo * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ interface SnapshotInfo { /** * Id of the snapshot. * * @type { ?string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ id?: string; /** * Size of the web. * * @type { ?SizeOptions } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ size?: SizeOptions; } /** * Defines the snapshot result. * * @typedef SnapshotResult * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ interface SnapshotResult { /** * Id of the snapshot. * * @type { ?string } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ id?: string; /** * The status of the snapshot. * * @type { ?boolean } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ status?: boolean; /** * Size of the web. * * @type { ?SizeOptions } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ size?: SizeOptions; /** * The image in PixelMap format. * * @type { ?image.PixelMap } * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ imagePixelMap?: image.PixelMap; } /** * Enum type supplied to {@link runJavaScriptExt} for indicating the result of JavaScript code execution. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Enum type supplied to {@link runJavaScriptExt} for indicating the result of JavaScript code execution. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Enum type supplied to {@link runJavaScriptExt} for indicating the result of JavaScript code execution. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ enum JsMessageType { /** * Unsupported data type. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Unsupported data type. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ NOT_SUPPORT, /** * The string data type. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The string data type. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The string data type. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ STRING, /** * The number data type. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The number data type. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The number data type. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ NUMBER, /** * The boolean data type. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The boolean data type. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The boolean data type. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ BOOLEAN, /** * The arraybuffer data type. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The arraybuffer data type. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ ARRAY_BUFFER, /** * The array data type. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The array data type. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The array data type. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ ARRAY } /** * The message for indicating the of result of JavaScript code execution. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * The message for indicating the of result of JavaScript code execution. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * The message for indicating the of result of JavaScript code execution. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ class JsMessageExt { /** * Get the type of the JavaScript code execution result. * @returns { JsMessageType } - Returns data of JsMessageType type * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the type of the JavaScript code execution result. * @returns { JsMessageType } - Returns data of JsMessageType type * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the type of the JavaScript code execution result. * @returns { JsMessageType } - Returns data of JsMessageType type * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getType(): JsMessageType; /** * Get the string value of the JavaScript code execution result. * @returns { string } - Returns data of string type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the string value of the JavaScript code execution result. * @returns { string } - Returns data of string type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the string value of the JavaScript code execution result. * @returns { string } - Returns data of string type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getString(): string; /** * Get the number value of the JavaScript code execution result. * @returns { number } - Returns data of number type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the number value of the JavaScript code execution result. * @returns { number } - Returns data of number type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the number value of the JavaScript code execution result. * @returns { number } - Returns data of number type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getNumber(): number; /** * Get the boolean value of the JavaScript code execution result. * @returns { boolean } - Returns data of Boolean type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the boolean value of the JavaScript code execution result. * @returns { boolean } - Returns data of Boolean type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the boolean value of the JavaScript code execution result. * @returns { boolean } - Returns data of Boolean type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getBoolean(): boolean; /** * Get the array buffer value of the JavaScript code execution result. * @returns { ArrayBuffer } - Returns data of ArrayBuffer * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the array buffer value of the JavaScript code execution result. * @returns { ArrayBuffer } - Returns data of ArrayBuffer * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ getArrayBuffer(): ArrayBuffer; /** * Get the array value of the the JavaScript code execution result. * @returns { Array } - Returns data of Array type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @since 10 */ /** * Get the array value of the the JavaScript code execution result. * @returns { Array } - Returns data of Array type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 11 */ /** * Get the array value of the the JavaScript code execution result. * @returns { Array } - Returns data of Array type * @throws { BusinessError } 17100014 - The type and value of the message do not match. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice * @since 18 */ getArray(): Array; } /** * Defines the render process mode. * * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ enum RenderProcessMode { /** * ArkWeb single rendering subprocess mode. In this mode, multiple Web pages reuse a rendering subprocess. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ SINGLE = 0, /** * ArkWeb multi-rendering subprocess mode. In this mode, there is one rendering subprocess per Web. * * @syscap SystemCapability.Web.Webview.Core * @atomicservice * @since 12 */ MULTIPLE, } /** * Options of generating code cache * @typedef CacheOptions * @syscap SystemCapability.Web.Webview.Core * @since 12 */ interface CacheOptions { /** * Response headers used to configure the validation key of code cache. * Currently only support E-Tag and Last-Modified. * * @type { Array } * @syscap SystemCapability.Web.Webview.Core * @since 12 */ responseHeaders: Array; } /** * Enum type supplied to {@link OfflineResourceMap} for indicating the type of resource. * @enum {number} * @syscap SystemCapability.Web.Webview.Core * @since 12 */ enum OfflineResourceType { /** * Resource of the image type. * * @syscap SystemCapability.Web.Webview.Core * @since 12 */ IMAGE, /** * Resource of the CSS type. * * @syscap SystemCapability.Web.Webview.Core * @since 12 */ CSS, /** * Javascript resource loaded through the