/* * 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 API Note: API Note: API Note: When using legacy ArkWeb Engine, some ArkWeb newly created API will not take effect, API Note: API Note: API Note:
*
* @param { object } object - Application side JavaScript objects participating in registration.
* @param { string } name - The name of the registered object, which is consistent with the
* object name called in the window.
* @param { Array API Note:
*
* @param { object } object - Application side JavaScript objects participating in registration.
* @param { string } name - The name of the registered object, which is consistent with the
* object name called in the window.
* @param { Array API Note:
*
* @param { string } script - JavaScript Script.
* @returns { Promise API Note:
*
* @param { string } script - JavaScript Script.
* @param { AsyncCallback API Note: API Note: API Note: API Note: API Note: API Note:
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
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
function once(type: string, callback: Callback
* You must load the Web component before calling the APIs in WebStorage.
*
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
* You must load the Web component before calling the APIs in WebDataBase.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
static getHttpAuthCredentials(host: string, realm: string): Array
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.
*
*
* You must load the Web component before calling the APIs in GeolocationPermissions.
*
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
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
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
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
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
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
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
static getStoredGeolocation(incognito?: boolean): Promise
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
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
static getStoredGeolocation(callback: AsyncCallback
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
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
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
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
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
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
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
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
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Save the cookies Asynchronously.
* @returns { Promise
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
static saveCookieAsync(): Promise
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Save the cookies Asynchronously.
* @param { AsyncCallback
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
static saveCookieAsync(callback: AsyncCallback
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
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
static clearAllCookies(callback: AsyncCallback
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Delete the session cookies Asynchronously.
* @param { AsyncCallback
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
static clearSessionCookie(callback: AsyncCallback
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
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
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
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
* see [Compatible with Legacy Web Engine in release note] for compatibility guidelines.
*
2. Incorrect parameter types. 3. Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
static setHttpDns(secureDnsMode: SecureDnsMode, secureDnsConfig: string): void;
/**
* Enables debugging of web contents.
* @param { boolean } webDebuggingAccess {@code true} enables debugging of web contents; {@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
* @since 9
*/
/**
* Enables debugging of web contents.
* @param { boolean } webDebuggingAccess {@code true} enables debugging of web contents; {@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
*/
/**
* Sets whether to enable web debugging. By default, web debugging is disabled.
* For details, see Debugging Frontend Pages by Using DevTools.
*
*
* Enabling web debugging allows users to check and modify the internal status of the web page,
* which poses security risks. Therefore, you are advised not to enable this function
* in the officially released version of the app.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
static setWebDebuggingAccess(webDebuggingAccess: boolean): void;
/**
* Enable the ability to check website security risks.
* Illegal and fraudulent websites are mandatory enabled and can't be disabled by this function.
* @param { boolean } enable - {@code true} enable check the website security risks; {@code false} otherwise.
* @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
*/
enableSafeBrowsing(enable: boolean): void;
/**
* Get whether checking website security risks is enabled.
* @returns { boolean } True if enable the ability to check website security risks else false.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
isSafeBrowsingEnabled(): boolean;
/**
* Checks whether the web page can go forward.
* @returns { boolean } True if the web page can go forward else false.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Checks whether the web page can go forward.
* @returns { boolean } True if the web page can go forward else false.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
accessForward(): boolean;
/**
* Checks whether the web page can go back.
* @returns { boolean } True if the web page can go back else false.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Checks whether the web page can go back.
* @returns { boolean } True if the web page can go back else false.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
accessBackward(): boolean;
/**
* Checks whether the web page can go back or forward the given number of steps.
*
* @param { number } step - The number of steps.
* @returns { boolean } True if the web page can go back else false.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Checks whether the web page can go back or forward the given number of steps.
*
* @param { number } step - The number of steps.
* @returns { boolean } True if the web page can go back else false.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
accessStep(step: number): boolean;
/**
* Goes forward in the history of the web page.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Goes forward in the history of the web page.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
forward(): void;
/**
* Goes back in the history of the web page.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Goes back in the history of the web page.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
backward(): void;
/**
* Clears the history in the Web.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Clears the history in the Web.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
clearHistory(): void;
/**
* Let the Web active.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Call this interface to notify the Web component to enter the foreground activation state.
* The activation state is the state in which the application interacts with the user.
* The application will remain in this state until something happens,
* such as receiving an incoming call or closing the screen of the device,
* to shift the focus away from the application.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
onActive(): void;
/**
* Let the Web inactive.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Call this interface to notify the Web component to enter the inactive state.
* In this callback, the developer can realize the appropriate behavior when the application loses focus.
* In this state, any content that can be safely paused will be paused as much as possible,
* such as animation and geographical location. However, JavaScript will not be paused.
* To pause JavaScript globally, please use {@link pauseAllTimers}.To reactivate the Web component, call onActive.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
onInactive(): void;
/**
* Refreshes the current URL.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Refreshes the current URL.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
refresh(): void;
/**
* Loads the data or URL.
*
* @param { string } data - A string encoded according to "Base64" or "URL".
* @param { string } mimeType - Media type. For example: "text/html".
* @param { string } encoding - Encoding type. For example: "UTF-8".
* @param { string } [baseUrl] - A specified URL path ("http"/"https"/"data" protocol),
* which is assigned to window.origin by the Web component.
* @param { string } [historyUrl] - History URL. When it is not empty, it can be managed by
* history records to realize the back and forth function.
* This property is invalid when baseUrl is empty.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100002 - URL error. The webpage corresponding to the URL is invalid, or the URL
* length exceeds 2048.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Loads the data or URL.
*
* @param { string } data - A string encoded according to "Base64" or "URL".
* @param { string } mimeType - Media type. For example: "text/html".
* @param { string } encoding - Encoding type. For example: "UTF-8".
* @param { string } [baseUrl] - A specified URL path ("http"/"https"/"data" protocol),
* which is assigned to window.origin by the Web component.
* @param { string } [historyUrl] - History URL. When it is not empty, it can be managed by
* history records to realize the back and forth function.
* This property is invalid when baseUrl is empty.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
loadData(data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string): void;
/**
* Loads the data or URL.
*
* @param { string | Resource } url - The URL to load.
* @param { Array
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100002 - URL error. The webpage corresponding to the URL is invalid, or the URL
* length exceeds 2048.
* @throws { BusinessError } 17100003 - Invalid resource path or file type.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
loadUrl(url: string | Resource, headers?: Array
2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100003 - Invalid resource path or file type.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
storeWebArchive(baseName: string, autoName: boolean): Promise
2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100003 - Invalid resource path or file type.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
storeWebArchive(baseName: string, autoName: boolean, callback: AsyncCallback
* zoomAccess must be true.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100004 - Function not enabled.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
zoom(factor: number): void;
/**
* Let the Web zoom in.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100004 - Function not enabled.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Let the Web zoom in.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100004 - Function not enabled.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Let the Web zoom in.
* Call this interface to enlarge the current page by 25%.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100004 - Function not enabled.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
zoomIn(): void;
/**
* Let the Web zoom out.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100004 - Function not enabled.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Let the Web zoom out.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100004 - Function not enabled.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Let the Web zoom out.
* Call this interface to shrink the current page by 20%.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100004 - Function not enabled.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
zoomOut(): void;
/**
* Gets the hit test value of HitTest.
* @returns { HitTestValue } Return the element information of the clicked area.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Get the element information of the currently clicked area.
* @returns { HitTestValue } Return the element information of the clicked area.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
* @deprecated since 18
* @useinstead ohos.web.webview.WebviewController#getLastHitTest
*/
getHitTestValue(): HitTestValue;
/**
* Gets the id for the current Web.
* @returns { number } Returns the index value of the current Web component.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Gets the id for the current Web.
* @returns { number } Returns the index value of the current Web component.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Gets the index value of the current Web component for the management of multiple Web components.
* @returns { number } Returns the index value of the current Web component.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
getWebId(): number;
/**
* Gets the default user agent.
* @returns { string } Return user agent information.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Gets the default user agent.
* @returns { string } Return user agent information.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
getUserAgent(): string;
/**
* Gets the title of current Web page.
* @returns { string } Return to File Selector Title.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Gets the title of current Web page.
* @returns { string } Return to File Selector Title.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
getTitle(): string;
/**
* Gets the content height of current Web page.
* @returns { number } Returns the page height of the current page.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Obtains the height of this web page.
* @returns { number } Height of the current web page. Unit: vp.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
getPageHeight(): number;
/**
* Goes forward or back backOrForward in the history of the web page.
*
* @param { number } step - Steps to go forward or backward.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Goes forward or back backOrForward in the history of the web page.
*
* @param { number } step - Steps to go forward or backward.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
backOrForward(step: number): void;
/**
* Gets the request focus.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Gets the request focus.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
requestFocus(): void;
/**
* Create web message ports
* @returns { Array
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
createWebMessagePorts(isExtentionType?: boolean): Array
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
postMessage(name: string, ports: Array
* Registed objects will not appear in JavaScript until the page is next (re)load.
* To avoid memory leaks, registerJavaScriptProxy must be used together with deleteJavaScriptProxy.
* To avoid security risks, it is recommended that registerJavaScriptProxy be used with trusted web components.
* If the same method is registered repeatedly in both synchronous and asynchronous list, it will default to an asynchronous method.
* The synchronous function list and asynchronous function list cannot be empty at the same time.
* otherwise, this registration will fail.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Registers the supplied ArkTS object into this Web component.
* The object is registered into all frames of the web page, including all iframes, using the specified name.
* This allows the methods of the ArkTS object to be accessed from JavaScript.
*
* Registed objects will not appear in JavaScript until the page is next (re)load.
* To avoid memory leaks, registerJavaScriptProxy must be used together with deleteJavaScriptProxy.
* To avoid security risks, it is recommended that registerJavaScriptProxy be used with trusted web components.
* If the same method is registered repeatedly in both synchronous and asynchronous list, it will default to an asynchronous method.
* The synchronous function list and asynchronous function list cannot be empty at the same time.
* otherwise, this registration will fail.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 20
*/
registerJavaScriptProxy(object: object, name: string, methodList: Array
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100008 - Failed to delete JavaScriptProxy because it does not exist.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Deletes a registered JavaScript object with given name.
*
* @param { string } name - The name of a registered JavaScript object 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 } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100008 - Failed to delete JavaScriptProxy because it does not exist.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 20
*/
deleteJavaScriptRegister(name: string): void;
/**
* Search all instances of 'searchString' on the page and highlights them,
* result will be notify through callback onSearchResultReceive.
*
* @param { string } searchString - String to be search.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Search all instances of 'searchString' on the page and highlights them,
* result will be notify through callback onSearchResultReceive.
*
* @param { string } searchString - String to be search.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
searchAllAsync(searchString: string): void;
/**
* Clears the highlighting surrounding text matches created by searchAllAsync.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Clears the highlighting surrounding text matches created by searchAllAsync.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
clearMatches(): void;
/**
* Highlights and scrolls to the next match search.
*
* @param { boolean } forward - Step of search is back or forward.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Highlights and scrolls to the next match search.
*
* @param { boolean } forward - Step of search is back or forward.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
searchNext(forward: boolean): void;
/**
* Clears the ssl cache in the Web.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Clears the ssl cache in the Web.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
clearSslCache(): void;
/**
* Clears the client authentication certificate cache in the Web.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Clears the client authentication certificate cache in the Web.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
clearClientAuthenticationCache(): void;
/**
* Loads a piece of code and execute JS code in the context of the currently displayed page.
*
* @param { string } script - JavaScript Script.
* @returns { Promise
* The state of JavaScript is no longer persisted across navigations like loadUrl.
* For example, global variables and functions defined before calling loadUrl will not exist in the loaded page.
* It is recommended that applications use registerJavaScriptProxy to ensure that the JavaScript state can be persisted across page navigations.
* If you cannot obtain the return value by executing the asynchronous method,
* you need to determine whether to use synchronous or asynchronous mode based on the specific situation.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
runJavaScript(script: string): Promise
* The state of JavaScript is no longer persisted across navigations like loadUrl.
* For example, global variables and functions defined before calling loadUrl will not exist in the loaded page.
* It is recommended that applications use registerJavaScriptProxy to ensure that the JavaScript state can be persisted across page navigations.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
runJavaScript(script: string, callback: AsyncCallback
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Execute JavaScript code in the context of the currently displayed page, and return the result.
*
* @param { string | ArrayBuffer } script - JavaScript Script.
* @returns { Promise
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
runJavaScriptExt(script: string | ArrayBuffer): Promise
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Execute JavaScript code in the context of the currently displayed page, and return the result.
*
* @param { string | ArrayBuffer } script - JavaScript Script.
* @param { AsyncCallback
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
runJavaScriptExt(script: string | ArrayBuffer, callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Scroll the contents of this Webview up by half the view size.
*
* @param { boolean } top - Whether to jump to the top of the page, if set to false,
* the page content will scroll up half the size of the viewframe,
* and when set to true, it will jump to the top of the page.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
pageUp(top: boolean): void;
/**
* Scroll the contents of this Webview down by half the view size.
*
* @param { boolean } bottom - Whether to jump to the top of the page, if set to false,
* the page content will scroll up half the size of the viewframe,
* and when set to true, it will jump to the top of the page.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Scroll the contents of this Webview down by half the view size.
*
* @param { boolean } bottom - Whether to jump to the top of the page, if set to false,
* the page content will scroll up half the size of the viewframe,
* and when set to true, it will jump to the top of the page.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Scroll the contents of this Webview down by half the view size.
*
* @param { boolean } bottom - Whether to jump to the top of the page, if set to false,
* the page content will scroll up half the size of the viewframe,
* and when set to true, it will jump to the top of the page.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
pageDown(bottom: boolean): void;
/**
* Gets the original url of current Web page.
* @returns { string } Return the original url of the current page.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Gets the original url of current Web page.
* @returns { string } Return the original url of the current page.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Gets the original url of current Web page.
* @returns { string } Return the original url of the current page.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
getOriginalUrl(): string;
/**
* Gets the favicon of current Web page.
* @returns { image.PixelMap } Return the favicon bitmap of the current page.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Gets the favicon of current Web page.
* @returns { image.PixelMap } Return the favicon bitmap of the current page.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
getFavicon(): image.PixelMap;
/**
* Put network state for web. Which is used to set window.navigator.onLine property in
* JavaScript.
* @param { boolean } enable - Whether enable window.navigator.onLine.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Put network state for web. Which is used to set window.navigator.onLine property in
* JavaScript.
* @param { boolean } enable - Whether enable window.navigator.onLine.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
setNetworkAvailable(enable: boolean): void;
/**
* Query if current document has image.
*
* @returns { Promise
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
hasImage(callback: AsyncCallback
* You can view the Webview cache in the data/storage/el2/base/cache/web/Cache directory.
*
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
removeCache(clearRom: boolean): void;
/**
* Remove resource cache in application. So this method will remove all cache for all web components in the
* same application.
*
* @param { boolean } clearRom - Remove cache in both rom and ram if true. Otherwise only clear cache
* in ram.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @since 18
*/
static removeAllCache(clearRom: boolean): void;
/**
* Scroll to the position.
*
* @param { number } x - the x of the position.
* @param { number } y - the y of the position.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Scroll to the position.
*
* @param { number } x - the x of the position.
* @param { number } y - the y of the position.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
/**
* Scroll to the position within specified time.
*
* @param { number } x - the x of the position.Unit: vp.
* @param { number } y - the y of the position.Unit: vp.
* @param { number } duration - the scroll animation duration. Unit: millisecond.
* If the value is not passed, or is negative or 0, there is no animation.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 14
*/
scrollTo(x: number, y: number, duration?: number): void;
/**
* Scroll by the delta position.
*
* @param { number } deltaX - the delta x of the position.
* @param { number } deltaY - the delta y of the position.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Scroll by the delta position.
*
* @param { number } deltaX - the delta x of the position.
* @param { number } deltaY - the delta y of the position.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
/**
* Scroll by the delta position within specified time.
*
*
* In nested scroll scenarios, calling scrollBy does not trigger nested scrolling in the parent component.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 14
*/
scrollBy(deltaX: number, deltaY: number, duration?: number): void;
/**
* Slide by the speed.
*
* @param { number } vx - the x speed of the speed.
* @param { number } vy - the y speed of the speed.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Slide by the speed.
*
* @param { number } vx - the x speed of the speed. Unit: vp/ms.
* @param { number } vy - the y speed of the speed. Unit: vp/ms.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
slideScroll(vx: number, vy: number): void;
/**
* Serialize the access stack of the web, that is, the history of access.
* @returns { Uint8Array } Web access stack after serialization.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Serialize the access stack of the web, that is, the history of access.
* @returns { Uint8Array } Web access stack after serialization.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
serializeWebState(): Uint8Array;
/**
* Restoring the web access stack, that is, the history of access.
* @param { Uint8Array } state - Web access stack after serialization.
* @throws { BusinessError } 401 - Invalid input parameter.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 9
*/
/**
* Restoring the web access stack, that is, the history of access.
* @param { Uint8Array } state - Web access stack after serialization.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
restoreWebState(state: Uint8Array): void;
/**
* Set whether the Web custom scheme supports cross domain and fetch requests.
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 17100020 - Failed to register custom schemes.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static customizeSchemes(schemes: Array
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 10
*/
/**
* Get certificate for the current website.
* @param {AsyncCallback
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
getCertificate(callback: AsyncCallback
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
setAudioMuted(mute: boolean): void;
/**
* Prefetch the resources required by the page, but will not execute js or render the page.
* @param { string } url - Which url to preresolve/preconnect.
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
setCustomUserAgent(userAgent: string): void;
/**
* Get custom user agent.
* @returns { string } Get custom User agent information.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 10
*/
/**
* Get custom user agent.
* @returns { string } Get custom User agent information.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 11
*/
getCustomUserAgent(): string;
/**
* Set web engine socket connection timeout.
* @param { number } timeout - Socket connection timeout.
* @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 setConnectionTimeout(timeout: number): void;
/**
* Set delegate for download.
* Used to notify the progress of the download triggered from web.
* @param { WebDownloadDelegate } delegate - Delegate used for download triggered from web.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Set delegate for download.
* Used to notify the progress of the download triggered from web.
* @param { WebDownloadDelegate } delegate - Delegate used for download triggered from web.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
setDownloadDelegate(delegate: WebDownloadDelegate): void;
/**
* Start a download.
* @param { string } url - The download url.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100002 - URL error. The webpage corresponding to the URL is invalid, or the URL
* length exceeds 2048.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Start a download.
* @param { string } url - The download url.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100002 - URL error. The webpage corresponding to the URL is invalid, or the URL
* length exceeds 2048.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
startDownload(url: string): void;
/**
* Loads the URL use "POST" method with post data.
*
* @param { string } url - Request the URL use "POST" method.
* @param { ArrayBuffer } postData - This data will passed to "POST" request.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100002 - URL error. The webpage corresponding to the URL is invalid, or the URL
* length exceeds 2048.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Loads the URL use "POST" method with post data.
*
* @param { string } url - Request the URL use "POST" method.
* @param { ArrayBuffer } postData - This data will passed to "POST" request.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 17100002 - URL error. The webpage corresponding to the URL is invalid, or the URL
* length exceeds 2048.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
postUrl(url: string, postData: ArrayBuffer): void;
/**
* Creates a PrintDocumentAdapter instance to provide content for printing.
* @param { string } jobName - Name of the file to print.
* @returns { print.PrintDocumentAdapter } Return PrintDocumentAdapter instance created.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 11
*/
createWebPrintDocumentAdapter(jobName: string): print.PrintDocumentAdapter;
/**
* Get the security level of the current page.
*
* @returns { SecurityLevel } the security level of current page.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
getSecurityLevel(): SecurityLevel;
/**
* Whether the incognito mode is set.
*
* @returns { boolean } {@code true} has been set the incognito mode; {@code false} otherwise.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
isIncognitoMode(): boolean;
/**
* Set whether scroll is allowed; default is true.
*
* @param { boolean } enable - Set whether scrolling is allowed
* {@code true} means scrolling is allowed.
* {@code false} means scrolling is disabled.
* @param { ScrollType } type - Enable scrolling type
* When the input parameter enable is false, it indicates that scrolling of the ScrollType type is prohibited.When ScrollType
* is not specified,it indicates that all types of webpage scrolling are prohibited.
* When the input parameter enable is true, regardless of whether ScrollType is specified, it indicates that all types
* of webpage scrolling are allowed.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setScrollable(enable: boolean, type?: ScrollType): void;
/**
* Get whether scrolling is allowed.
* @returns { boolean } Get scrolling is allowed information.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
getScrollable(): boolean;
/**
* Set whether print web page background.
*
* @param { boolean } enable - Set whether print web page background
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setPrintBackground(enable: boolean): void;
/**
* Get whether print web page background.
* @returns { boolean } Get whether print web page background.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getPrintBackground(): boolean;
/**
* Get the url of the last frame that calls the JavaScriptProxy.
* This should be called on the UI thread.
*
* @returns { string } The url of the last frame that calls the JavaScriptProxy.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
getLastJavascriptProxyCallingFrameUrl(): string;
/**
* Start current camera, and before using the camera function, please add the permission in module.json5: ohos.permission.CAMERA.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
startCamera(): void;
/**
* Stop current camera.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
stopCamera(): void;
/**
* Close current camera.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
closeCamera(): void;
/**
* Pause all WebView timers.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static pauseAllTimers(): void;
/**
* Resume all timers suspended from the pauseAllTimers() interface.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static resumeAllTimers(): void;
/**
* Stop all audio and video playback on the web page.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
stopAllMedia(): void;
/**
* Resumes the playback of the audio and video that are paused by the pauseAllMedia interface.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
resumeAllMedia(): void;
/**
* Pause all audio and video playback on the web page.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
pauseAllMedia(): void;
/**
* Closes all full-screen videos on a web page.
*
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
closeAllMediaPresentations(): void;
/**
* View the playback status of all audio and video on the web page.
*
* @returns { MediaPlaybackState } The playback status of all audio and video.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getMediaPlaybackState(): MediaPlaybackState;
/**
* Set web scheme handler for specific scheme. This is only used for related web component.
*
* @param { string } scheme - String value for url scheme.
* @param { WebSchemeHandler } handler - Web scheme handler.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setWebSchemeHandler(scheme: string, handler: WebSchemeHandler): void;
/**
* Clear all web scheme handlers for related web component.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since arkts {'1.1':'12', '1.2':'20'}
* @arkts 1.1&1.2
*/
clearWebSchemeHandler(): void;
/**
* Set web scheme handler for specific scheme. This is used for service worker.
* @param { string } scheme - String value for url scheme.
* @param { WebSchemeHandler } handler - Web scheme handler.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static setServiceWorkerWebSchemeHandler(scheme: string, handler: WebSchemeHandler): void;
/**
* Clear all web service worker scheme handlers.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static clearServiceWorkerWebSchemeHandler(): void;
/**
* Enable the ability to use Intelligent Tracking Prevention; default is disabled.
*
* @param { boolean } enable {@code true} enable Intelligent Tracking Prevention; {@code false} otherwise.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Enable the ability to use Intelligent Tracking Prevention; default is disabled.
*
* @param { boolean } enable {@code true} enable Intelligent Tracking Prevention; {@code false} otherwise.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
enableIntelligentTrackingPrevention(enable: boolean): void;
/**
* Get whether Intelligent Tracking Prevention is enabled.
*
* @returns { boolean } True if enable the Intelligent Tracking Prevention; else false.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Get whether Intelligent Tracking Prevention is enabled.
*
* @returns { boolean } True if enable the Intelligent Tracking Prevention; else false.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
isIntelligentTrackingPreventionEnabled(): boolean;
/**
* Add bypassing hosts for Intelligent Tracking Prevention.
*
* @param { Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Add bypassing hosts for Intelligent Tracking Prevention.
*
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
static addIntelligentTrackingPreventionBypassingList(hostList: Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Remove bypassing hosts for Intelligent Tracking Prevention.
*
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
static removeIntelligentTrackingPreventionBypassingList(hostList: Array
* Only screenshots of assets on the rendering process are supported: still images and text.
* If there is a video on the page, the placeholder image of the video will be displayed when you take a screenshot,
* and blank if there is no placeholder.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static setRenderProcessMode(mode: RenderProcessMode): void;
/**
* Get render process mode of the ArkWeb.
*
* @returns { RenderProcessMode } mode - The render process mode of the ArkWeb.
* Call {@link getRenderProcessMode} to get the ArkWeb rendering subprocess mode of the current device,
* with an enumeration value of 0 as a single subprocess mode and an enumeration value of 1 as a multi-subprocess mode.
* If the obtained value is not within the range of the RenderProcessMode enumeration value,
* it defaults to the multi-rendering subprocess mode.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static getRenderProcessMode(): RenderProcessMode;
/**
* Destroy the rendering process.
* Calling this interface will actively destroy the associated rendering process.
* If the rendering process has not been started or destroyed, it has no effect.
* In addition, destroying the rendering process will also affect all other instances associated with
* the rendering process.
*
* @returns { boolean } true if it was possible to terminate the render process, otherwise false.
* Calling this on a not yet started, or an already terminated render will have no effect.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 12
*/
terminateRenderProcess(): boolean;
/**
* Compile javascript and generate code cache.
* @param { string } url - Url of the javascript. Only support HTTP/HTTPS protocol and length no longer than 2048.
* @param { string | Uint8Array } script - Javascript source code. script must not be empty.
* @param { CacheOptions } cacheOptions - Generate code cache option.
* @returns { Promise
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static setHostIP(hostName: string, address: string, aliveTime: number): void;
/**
* Clear the host name IP address.
*
* @param { string } hostName - Which host name to be cleared.
* @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 12
*/
static clearHostIP(hostName: string): void;
/**
* Warmup the registered service worker associated the url.
* @param { string } url - The url.
* @throws { BusinessError } 17100002 - URL error. The webpage corresponding to the URL is invalid, or the URL
* length exceeds 2048.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static warmupServiceWorker(url: string): void;
/**
* Inject offline resources into cache.
*
* @param { Array
2. Parameter string is too long. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Enable the ability to block Ads, disabled by default.
*
* @param { boolean } enable {@code true} Enable Ads block; {@code false} otherwise.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Parameter string is too long. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
enableAdsBlock(enable: boolean): void;
/**
* Get whether Ads block is enabled.
*
* @returns { boolean } True if the ability of AdsBlock is enabled; else false.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Get whether Ads block is enabled.
*
* @returns { boolean } True if the ability of AdsBlock is enabled; else false.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
isAdsBlockEnabled(): boolean;
/**
* Get whether Ads block is enabled for current Webpage.
*
* @returns { boolean } True if the ability of AdsBlock is enabled for current Webpage; else false.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Get whether Ads block is enabled for current Webpage.
*
* @returns { boolean } True if the ability of AdsBlock is enabled for current Webpage; else false.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
isAdsBlockEnabledForCurPage(): boolean;
/**
* Get the ID of the surface created by ArkWeb. This ID can be used for web page screenshots.
*
* @returns { string } The ID of the surface created by ArkWeb.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getSurfaceId(): string;
/**
* Set the URL trust list for the ArkWeb.
* When the URL trust list has been set, only the URLs in the list can be accessed.
*
* @param { string } urlTrustList - the URL trust list in JSON format.
* An empty string means that all URLs are allowed to access.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Parameter string is too long. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setUrlTrustList(urlTrustList: string): void;
/**
* Sets a path list. When a file protocol accesses resources in the path list, it can access the local files across
* domains. In addition, when a path list is set, the file protocol can access only the resources in the path list.
* The behavior of {@link fileAccess} will be overwritten by that of this API.
*
* The paths in the list must be any of the following(sub path and module name must be provided):
*
* 1. The path of subdirectory of the application file directory, like "/data/storage/el2/base/files/example"
* or "/data/storage/el2/base/haps/entry/files/example".
* The application file directory is obtained using Context.filesDir in the Ability Kit.
* 2. The path of application resource directory or its subdirectory, like "/data/storage/el1/bundle/entry/resource/resfile"
* or "/data/storage/el1/bundle/entry/resource/resfile/example".
* The application resource directory is obtained from Context.resourceDir in the Ability Kit.
*
* If a path in the list is not of the preceding paths, error code 401 is reported and the path list fails
* to be set. When the path list is set to empty, the accessible files for the file protocol are subject to
* the behavior of the {@link fileAccess}.
*
* @param { Array
2. Parameter string is too long. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 12
*/
setPathAllowingUniversalAccess(pathList: Array
2. Parameter string is too long. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 14
*/
static trimMemoryByPressureLevel(level: PressureLevel): void;
/**
* Enable the BackForwardCache and indicate features that are allowed to enter BackForwardCache.
* Default is disabled.
*
* @param { BackForwardCacheSupportedFeatures } features - The features that supports BackForwardCache.
* @syscap SystemCapability.Web.Webview.Core
* @since 12
*/
static enableBackForwardCache(features: BackForwardCacheSupportedFeatures): void;
/**
* Configure the BackForwardCache.
*
* @param { BackForwardCacheOptions } options - The configuration of BackForwardCache.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 12
*/
setBackForwardCacheOptions(options: BackForwardCacheOptions): void;
/**
* The current scroll offset of the web page (including the over-scroll offset).
*
* @returns { ScrollOffset } The current scroll offset of the web page (including the over-scroll offset).
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 13
*/
getScrollOffset(): ScrollOffset;
/**
* Scrolls by the specified delta position and returns a result indicating whether the scrolling operation was successful or not.
*
* @param { number } deltaX - the delta x of the position. Unit: vp.
* @param { number } deltaY - the delta y of the position. Unit: vp.
* @returns { boolean } true if the scroll operation is successful, otherwise false.
* Return value scenario: when the Web page is in the touch state, return false, otherwise return true.
* In the same layer rendering scene, when the same layer rendering area of ​​the Web is in the touching state, the return value is true.
* In a nested scrolling scenario, calling scrollByWithResult will not trigger nested scrolling of the parent component.
* This interface does not guarantee sliding frame rate performance.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 12
*/
scrollByWithResult(deltaX: number, deltaY: number): boolean;
/**
* Gets the last hit test value of HitTest.
* @returns { HitTestValue } Return the element information of the clicked area.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @syscap SystemCapability.Web.Webview.Core
* @since 18
*/
getLastHitTest(): HitTestValue;
/**
* The current scroll offset of the web page (excluding over-scroll offset).
*
* @returns { ScrollOffset } The current scroll offset of the web page (excluding over-scroll offset).
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
getPageOffset(): ScrollOffset;
/**
* Set the default User-Agent for the application.
*
*
* Unlike setCustomUserAgent, which only takes effect in the current web context, the
* priority for pages loaded in the web is as follows:
* 1. The User-Agent set by setCustomUserAgent is used first.
* 2. If not set, it will check whether a specific User-Agent has been
* assigned to the current page via setUserAgentForHosts.
* 3. If no specific User-Agent is assigned, the application will fall back
* to using the User-Agent set by setAppCustomUserAgent.
* 4. If the app's default User-Agent is also not specified, the web's default
* User-Agent will be used as the final fallback.
*
* Setting the same host list multiple times for the same User-Agent will override
* the previous settings. That is, if you want to cancel certain hosts from using
* the specified User-Agent, you need to reset the host list for that User-Agent.
*
2. Incorrect parameter types. 3. Parameter verification failed.
* @static
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
static setUserAgentForHosts(userAgent: string, hosts : Array
* The port numbers from 0 to 1024 are prohibited. Ports less than 0 or greater than 65535 are considered invalid.
* If an attempt is made to set these disabled or invalid ports, an exception will be thrown.
*
and the visible viewport upward avoids avoidHeight, as manifested by the web page content raising avoidHeight.
*
This interface is generally used for customizing the bottom avoidance area, and it is not recommended for
*
simultaneous use with clicking the editable area of the web page showing the keyboard.
*
In this case, the keyboardAvoidMode will be OVERLAYS_CONTENT.
* When setting zero, web page content can be restored and the keyboardAvoidMode will be the value set by keyboardAvoidMode().
*
* @param { number } avoidHeight - the height value of the visible viewport avoidance. Unit: vp.
*
The valid interval of avoidHeight is [0, the height of web component].
*
When avoidHeight is out of the valid interval, it takes the boundary value of the interval.
* @throws { BusinessError } 17100001 - Init error.
* The WebviewController must be associated with a Web component.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
avoidVisibleViewportBottom(avoidHeight: number): void;
/**
* Obtains the prediction information about the blankless loading solution and enables the generation of
* the transition frame for the current loading. The application determines whether to enable the blankless
* loading solution based on the information.
*
* @param { string } key The key value that uniquely identifies the page.
* Default value: N/A.
* The value cannot be empty or exceed 2048 characters.
* When an invalid value is set, this API does not take effect.
* @returns { BlanklessInfo } The prediction information about the blankless loading solution.
* @throws { BusinessError } 801 Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
getBlanklessInfoWithKey(key: string) : BlanklessInfo;
/**
* Sets whether to enable blankless page loading. This API must be used in pair with the
* getBlanklessInfoWithKey API.
*
* @param { string } key The key value that uniquely identifies the current page. It must be the same as
* the key value of the getBlanklessInfoWithKey API.
* Default value: N/A.
* The value cannot be empty or exceed 2048 characters.
* When an invalid value is set, the error code WebBlanklessErrorCode is returned, and the API does not
* take effect.
* @param { boolean } is_start Whether to enable frame interpolation. The value true indicates to enable
* frame interpolation, and the value false indicates the opposite.
* The default value is false.
* The value can be true or false.
* Action for setting an invalid value: N/A.
* @returns { WebBlanklessErrorCode } WebBlanklessErrorCode.
* @throws { BusinessError } 801 Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
setBlanklessLoadingWithKey(key: string, is_start: boolean) : WebBlanklessErrorCode;
/**
* Clears the blankless loading cache of the page with a specified key value.
*
* @param { Array
2. Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Start the web download.
* Used in onBeforeDownload, If you want to start the current download, call this function.
* @param { string } downloadPath - The content will be downloaded to this file.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
*
2. Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
start(downloadPath: string): void;
/**
* Cancel the web download.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Cancel the web download.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
cancel(): void;
/**
* Pause the web download.
* @throws { BusinessError } 17100019 - The download task is not started yet.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Pause the web download.
* @throws { BusinessError } 17100019 - The download task is not started yet.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
pause(): void;
/**
* Resume the web download.
* Use WebDownloadManager.resumeDownload to resume deserialized downloads.
* WebDownloadItem.resume is only used to resume the currently paused download.
* @throws { BusinessError } 17100016 - The download task is not paused.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Resume the web download.
* Use WebDownloadManager.resumeDownload to resume deserialized downloads.
* WebDownloadItem.resume is only used to resume the currently paused download.
* @throws { BusinessError } 17100016 - The download task is not paused.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
resume(): void;
/**
* Get received bytes.
* @returns { number } - Returns the received bytes.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Get received bytes.
* @returns { number } - Returns the received bytes.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
getReceivedBytes(): number;
/**
* Get full path of the web download.
* @returns { string } - Returns the full path of the download.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* Get full path of the web download.
* @returns { string } - Returns the full path of the download.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since 18
*/
getFullPath(): string;
/**
* Serialize web download to typed array.
* @returns { Uint8Array } - Returns the serialized data.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
serialize(): Uint8Array;
/**
* Deserialize web download from typed array.
* @param { Uint8Array } serializedData - The serialized data.
* @returns { WebDownloadItem } - Deserialize the serialized data into a WebDownloadItem.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
*
2. Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
static deserialize(serializedData: Uint8Array): WebDownloadItem;
}
/**
* The download state is notified through this delegate.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 11
*/
/**
* The download state is notified through this delegate.
* @syscap SystemCapability.Web.Webview.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'18', '1.2':'20'}
* @arkts 1.1&1.2
*/
class WebDownloadDelegate {
/**
* Callback will be triggered before web download start.
* @param { Callback
2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
read(size: number): Promise
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setNetErrorCode(code: WebNetErrorList): void;
/**
* Get net error code.
*
* @returns { WebNetErrorList } Return response error code.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getNetErrorCode(): WebNetErrorList;
/**
* Set http status code.
*
* @param { number } code - Http status code.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setStatus(code: number): void;
/**
* Get http status code.
*
* @returns { number } Return http status code.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getStatus(): number;
/**
* Set status text.
*
* @param { string } text - Status text.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setStatusText(text: string): void;
/**
* Get status text.
*
* @returns { string } Return http status text.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getStatusText(): string;
/**
* Set mime type.
*
* @param { string } type - Mime type.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setMimeType(type: string): void;
/**
* Get mime type.
*
* @returns { string } Return mime type of response.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getMimeType(): string;
/**
* Set the response encoding.
*
* @param { string } encoding - Encoding.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setEncoding(encoding: string): void;
/**
* Get the response encoding.
*
* @returns { string } Return encoding of response.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getEncoding(): string;
/**
* Set response hander value by name.
*
* @param { string } name - Header name.
* @param { string } value - Header value.
* @param { boolean } overwrite - Whether to overwrite.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
setHeaderByName(name: string, value: string, overwrite: boolean): void;
/**
* Get the header value by name from the response.
*
* @param { string } name - Header name.
* @returns { string } Return header value by name.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
getHeaderByName(name: string): string
}
/**
* Used to intercept url requests. Response headers and body can be sent through
* WebResourceHandler.
*
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
class WebResourceHandler {
/**
* Pass response headers to intercepted requests.
*
* @param { WebSchemeHandlerResponse } response - Set response header to intercept.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* @throws { BusinessError } 17100021 - The resource handler is invalid.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
didReceiveResponse(response: WebSchemeHandlerResponse): void;
/**
* Pass response body data to intercepted requests.
*
* @param { ArrayBuffer } data - Set response body to intercept.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* @throws { BusinessError } 17100021 - The resource handler is invalid.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
didReceiveResponseBody(data: ArrayBuffer): void;
/**
* Notify that this request should be finished and there is no more data available.
*
* @throws { BusinessError } 17100021 - The resource handler is invalid.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
didFinish(): void;
/**
* Notify that this request should be failed.
*
* @param { WebNetErrorList } code - Set response error code to intercept.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types.
* @throws { BusinessError } 17100021 - The resource handler is invalid.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
didFail(code: WebNetErrorList): void;
/**
* Notify that this request should be failed.
*
* @param { WebNetErrorList } code - Set response error code to intercept.
* @param { boolean } completeIfNoResponse - If completeIfNoResponse is true, when DidFailWithError is called, if
* DidReceiveResponse has not been called, a response is automatically
* constructed and the current request is terminated.
* @throws { BusinessError } 17100101 - The errorCode is either ARKWEB_NET_OK or outside the range of error codes
* in WebNetErrorList.
* @throws { BusinessError } 17100021 - The resource handler is invalid.
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
didFail(code: WebNetErrorList, completeIfNoResponse: boolean): void;
}
/**
* This class is used to intercept requests for a specified scheme.
*
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
class WebSchemeHandler {
/**
* Callback for handling the request.
*
* @param { function } callback - Callback of handling the request. If callback return false,
* it means no interception.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
onRequestStart(
callback: (request: WebSchemeHandlerRequest, handler: WebResourceHandler) => boolean): void;
/**
* Callback when the request is completed.
*
* @param { Callback
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* set Ads Block ruleset file, containing easylist rules.
* @param {string} rulesFile - absolute file path contains app customized ads block rules.
* @param {boolean} replace - (@code true)replace internal rules;(@code false) add to internal rules.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
static setAdsBlockRules(rulesFile: string, replace: boolean): void;
/**
* Add items to Ads Block Disallow list.
* @param { Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Add items to Ads Block Disallow list.
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
static addAdsBlockDisallowedList(domainSuffixes: Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* Add items to Ads Block Allow list.
* By default, ads block is allowed for all pages unless they are added to the
* disallow list. The priority of allowlist is higher than the disallowlist. It is
* used to re-enable ads block on the page that matches disallow list.
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
static addAdsBlockAllowedList(domainSuffixes: Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* remove items from Ads Block Disallowed list.
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
static removeAdsBlockDisallowedList(domainSuffixes: Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
/**
* remove items from Ads Block Allowed list.
* @param { Array
2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 18
*/
static removeAdsBlockAllowedList(domainSuffixes: Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* Insert a bypass rule that indicates URLs that should skip the override proxy and connect the server directly instead.
* These maybe URLs or IP addresses and wildcards are supported. e.g. "*.example.com" means that requests to
* "https://www.example.com" and "http://test.example.com" will connect the server directly.
*
* @param { string } bypassRule - The bypass rule.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
insertBypassRule(bypassRule: string): void;
/**
* Insert a proxy rule that indicates URLs that match the schemeFilter will connect the server directly.
*
* @param { ProxySchemeFilter } schemeFilter - The scheme filter for this rule.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* Insert a proxy rule that indicates URLs that match the schemeFilter will connect the server directly.
*
* @param { ProxySchemeFilter } schemeFilter - The scheme filter for this rule.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
insertDirectRule(schemeFilter?: ProxySchemeFilter): void;
/**
* Insert a proxy rule which indicates that requests matching the schemeFilter should use an override proxy, all requests will
* use the proxy rule if schemeFilter is null.
*
* The format for proxy is [scheme://]host[:port]. Scheme is optional and must be HTTP, HTTPS, or SOCKS if present. Scheme defaults to HTTP.
* Host is an IPv6 literal with brackets, an IPv4 literal or one or more labels seperated by a period. Port number is optional and defaults
* to 80 for HTTP, 443 for HTTPS and 1080 for SOCKS.
*
* e.g. example.com host: example.com
* https://example.com scheme: https host: example.com
* example.com:8888 host: example.com port: 8888
* https://example.com:8888 scheme:https host: example.com port:8888
* 192.168.1.1 host: 192.168.1.1
* 192.168.1.1:8888 host:192.168.1.1 port: 8888
* [10:20:30:40:50:60:70:80]
*
* @param { string } proxyRule - The proxy rule.
* @param { ProxySchemeFilter } schemeFilter - The scheme filter for this rule.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* Insert a proxy rule which indicates that requests matching the schemeFilter should use an override proxy, all requests will
* use the proxy rule if schemeFilter is null.
*
* The format for proxy is [scheme://]host[:port]. Scheme is optional and must be HTTP, HTTPS, or SOCKS if present. Scheme defaults to HTTP.
* Host is an IPv6 literal with brackets, an IPv4 literal or one or more labels seperated by a period. Port number is optional and defaults
* to 80 for HTTP, 443 for HTTPS and 1080 for SOCKS.
*
* e.g. example.com host: example.com
* https://example.com scheme: https host: example.com
* example.com:8888 host: example.com port: 8888
* https://example.com:8888 scheme:https host: example.com port:8888
* 192.168.1.1 host: 192.168.1.1
* 192.168.1.1:8888 host:192.168.1.1 port: 8888
* [10:20:30:40:50:60:70:80]
*
* @param { string } proxyRule - The proxy rule.
* @param { ProxySchemeFilter } schemeFilter - The scheme filter for this rule.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
insertProxyRule(proxyRule: string, schemeFilter?: ProxySchemeFilter): void;
/**
* Hostnames without a period in them (and that are not IP literals) will skip the proxy and connect the server directly.
* Examples: "abc", "local", "some-domain".
*
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* Hostnames without a period in them (and that are not IP literals) will skip the proxy and connect the server directly.
* Examples: "abc", "local", "some-domain".
*
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
bypassHostnamesWithoutPeriod(): void;
/**
* By default, certain hostnames implicitly bypass the proxy if they are link-local IPs, or localhost addresses. For instance
* hostnames matching any of (non-exhaustive list): localhost *.localhost [::1] 127.0.0.1/8 169.254/16 [FE80::]/10
* Call this function to override the default behavior and force localhost and link-local URLs to be sent through the proxy.
*
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* By default, certain hostnames implicitly bypass the proxy if they are link-local IPs, or localhost addresses. For instance
* hostnames matching any of (non-exhaustive list): localhost *.localhost [::1] 127.0.0.1/8 169.254/16 [FE80::]/10
* Call this function to override the default behavior and force localhost and link-local URLs to be sent through the proxy.
*
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
clearImplicitRules(): void;
/**
* Reverse the bypass rules.
*
* If false all URLs will use proxy settings except URLs match the bypass rules.
* If true only URLs in the bypass list will use proxy, and all other URLs will be connected to directly.
*
* @param { boolean } reverse - If reverse the bypass rule.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* Reverse the bypass rules.
*
* If false all URLs will use proxy settings except URLs match the bypass rules.
* If true only URLs in the bypass list will use proxy, and all other URLs will be connected to directly.
*
* @param { boolean } reverse - If reverse the bypass rule.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
enableReverseBypass(reverse: boolean): void;
/**
* Returns the bypass rules.
*
* @returns { Array
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* Sets ProxyConfig which will be used by all Webs in the app. URLs that match patterns in the bypass list will connect the server directly.
* Instead, the request will use the proxy specified by the config. Requests are not guaranteed to use the new proxy immediately; wait for
* the listener before loading a page. This listener will be called on the UI thread.
* Note: calling applyProxyOverride will cause any existing system wide setting to be ignored.
*
* @param { ProxyConfig } proxyConfig - The proxy config.
* @param { OnProxyConfigChangeCallback } callback - Called when the proxy has been changed.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
static applyProxyOverride(proxyConfig: ProxyConfig, callback: OnProxyConfigChangeCallback): void;
/**
* Remove the proxy config. Requests are not guaranteed to not use the proxy; Wait for the listener before loading a page. This listener
* will be called on the UI thread.
*
* @param { OnProxyConfigChangeCallback } callback - Called when the proxy has been changed.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @since 15
*/
/**
* Remove the proxy config. Requests are not guaranteed to not use the proxy; Wait for the listener before loading a page. This listener
* will be called on the UI thread.
*
* @param { OnProxyConfigChangeCallback } callback - Called when the proxy has been changed.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 19
*/
static removeProxyOverride(callback: OnProxyConfigChangeCallback): void;
}
/**
* Enum type supplied to {@link SetWebDestroyMode} for indicating the web component destroy mode.
* @enum { number }
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
enum WebDestroyMode {
/**
* The normal destroy mode, when the web component triggers destroy,
* the resources will be released at the appropriate time.
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
NORMAL_MODE = 0,
/**
* The fast destroy mode, when the web component triggers destroy, the resources will be immediately released.
* @syscap SystemCapability.Web.Webview.Core
* @since 20
*/
FAST_MODE = 1
}
}
export default webview;