diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index 667cc3e6dc75e2fcab5016d8a6e9daad0acc68e0..4b1597f78db8445d885635b69904624beafcffd0 100644 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -4117,7 +4117,14 @@ declare class WebController { clearHistory(): void; /** - * Loads a piece of code and execute JS code in the context of the currently displayed page. + * Asynchronously execute JavaScript in the context of the currently displayed page. + * The result of the script execution will be returned through an asynchronous callback. + * This method must be used on the UI thread, and the callback will also be invoked on the UI thread. + *

API Note:
+ * 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. + *

* * @param { object } options The options with a piece of code and a callback. * @syscap SystemCapability.Web.Webview.Core @@ -6345,7 +6352,13 @@ declare class WebAttribute extends CommonMethod { * @since 11 */ /** - * Sets whether enable local file system access in Web. + * Sets whether to enable access to the file system in the application. + * This setting dose not affect the access to the files specified though $rawfile(filepath/filename). + *

API Note:
+ * fileAccess is disabled by default since API version 12. + * When fileAccess is set to false, files in the read-only /data/storage/el1/bundle/entry/resources/resfile
+ * directory can still be accessed through the file protocol. + *

* * @param { boolean } fileAccess - {@code true} means enable local file system access in Web; {@code false} otherwise. * The default value is false. @@ -6430,7 +6443,8 @@ declare class WebAttribute extends CommonMethod { * @since 8 */ /** - * Sets how to load HTTP and HTTPS content. + * Sets the behavior when a secure origin attempts to load a resource from an insecure origin. + * The default is MixedMode.None, meaning not allow a secure origin to load content from an insecure origin. * * @param { MixedMode } mixedMode - The mixed mode, which can be {@link MixedMode}. * @returns { WebAttribute } @@ -6520,9 +6534,12 @@ declare class WebAttribute extends CommonMethod { * @since 11 */ /** - * Injects the JavaScript object into window and invoke the function in window. + * Registers the supplied ArkTS object in javaScriptProxy into this Web component. + * The object is registered into all frames of the web page, including all frames, using the specified name in javaScriptProxy. + * This allows the methods of the ArkTS object in javaScriptProxy to be accessed from JavaScript. * - * @param { JavaScriptProxy } javaScriptProxy - The JavaScript object to be injected. + * @param { JavaScriptProxy } javaScriptProxy - The ArkTS object in javaScriptProxy will be registered into this Web component, + * and the methods within the methodList of the injected ArkTS object declared in javaScriptProxy can be accessed by JavaScript. * @returns { WebAttribute } * @syscap SystemCapability.Web.Webview.Core * @atomicservice @@ -6802,9 +6819,10 @@ declare class WebAttribute extends CommonMethod { */ /** * Triggered at the end of web page loading. + * This callback is only invoked for the main frame and not for subframes. * * @param { Callback } callback The triggered function at the end of web page loading. - * @returns { WebAttribute } + * @returns { WebAttribute } The WebAttribute object representing the attributes of the web page. * @syscap SystemCapability.Web.Webview.Core * @crossplatform * @atomicservice @@ -6840,7 +6858,8 @@ declare class WebAttribute extends CommonMethod { * @since 11 */ /** - * Triggered at the begin of web page loading. + * Called when the web page starts to be loaded. + * This API is called only for the main frame, and not for the iframe or frameset content. * * @param { Callback } callback The triggered function at the begin of web page loading. * @returns { WebAttribute } @@ -6900,7 +6919,9 @@ declare class WebAttribute extends CommonMethod { * @since 11 */ /** - * Triggered when the title of the main application document changes. + * Notifies the application that the title has changed.. + * If the page being loaded does not specify a title via the element, + * ArkWeb will generate a title baseed on the URL and return it to the application. * * @param { Callback<OnTitleReceiveEvent> } callback The triggered function when the title of the main application document changes. * @returns { WebAttribute } @@ -7725,7 +7746,8 @@ declare class WebAttribute extends CommonMethod<WebAttribute> { * @since 11 */ /** - * Triggered when the Web page receives an ssl Error. + * Called to notify users when an SSL error occurs with a request for the main frame. + * To include errors with requests for subframes, use the OnSslErrorEvent API. * * @param { Callback<OnSslErrorEventReceiveEvent> } callback The triggered callback when the Web page receives an ssl Error. * @returns { WebAttribute } @@ -7736,7 +7758,8 @@ declare class WebAttribute extends CommonMethod<WebAttribute> { onSslErrorEventReceive(callback: Callback<OnSslErrorEventReceiveEvent>): WebAttribute; /** - * Triggered when the Web page receives an ssl Error. + * Called to notify users when an SSL error occurs during the loading of resources (for the main frame and subframes). + * To handle SSL errors for requests for the main frame, use the isMainFrame field to distinguish. * * @param { OnSslErrorEventCallback } callback The triggered callback when the Web page receives an ssl Error. * @returns { WebAttribute } @@ -8489,7 +8512,15 @@ declare class WebAttribute extends CommonMethod<WebAttribute> { onIntelligentTrackingPreventionResult(callback: OnIntelligentTrackingPreventionCallback): WebAttribute; /** - * Injects the JavaScripts before Webview creates the DOM tree, and then the JavaScript snippet will run after the document has been created. + * Injects the JavaScripts script into the Web component. + * When the specified page or document starts to be loaded, the script is executed on any page whose source matches scriptRules. + * <p><strong>API Note</strong>:<br> + * The script runs before any JavaScript code of the page, when the DOM tree may not have been loaded or rendered. + * The script is executed in the lexicographic order, not the array order. + * If the array order is required, you are advised to use the runJavaScriptOnDocumentStart interface. + * You are not advised to use this API together with runJavaScriptOnDocumentStart. + * </p> + * * @param { Array<ScriptItem> } scripts - The array of the JavaScripts to be injected. * @returns { WebAttribute } * @syscap SystemCapability.Web.Webview.Core @@ -8499,7 +8530,15 @@ declare class WebAttribute extends CommonMethod<WebAttribute> { javaScriptOnDocumentStart(scripts: Array<ScriptItem>): WebAttribute; /** - * Injects the JavaScripts before Webview creates the DOM tree, and then the JavaScript snippet will run after the document has been created. + * Injects the JavaScripts script into the Web component. + * When the specified page or document has been loaded, the script is executed on any page whose source matches scriptRules. + * <p><strong>API NOTE</strong>:<br> + * The script runs after any JavaScript code of the page, when the DOM tree has been loaded and rendered. + * The script is excuted in the lexicographic order, not the array order. + * If the array order is required, you are advised to use the runJavaScriptOnDocumentEnd interface. + * You are not advised to use this API together with runJavaScriptOnDocumentEnd. + * <p> + * * @param { Array<ScriptItem> } scripts - The array of the JavaScripts to be injected. * @returns { WebAttribute } * @syscap SystemCapability.Web.Webview.Core diff --git a/api/@ohos.web.webview.d.ts b/api/@ohos.web.webview.d.ts index 3d34d4c9ee7401b0c2120aa3fefef8810dd57675..e76eb1d20060531b8641fe95322796c05a570e2d 100644 --- a/api/@ohos.web.webview.d.ts +++ b/api/@ohos.web.webview.d.ts @@ -3734,7 +3734,17 @@ declare namespace webview { * @since 11 */ /** - * Registers the JavaScript object and method list. + * 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. + * <p><strong>API Note</strong>:<br> + * 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,<br> + * otherwise, this registration will fail. + * <p> * * @param { object } object - Application side JavaScript objects participating in registration. * @param { string } name - The name of the registered object, which is consistent with the