1# ArkUI Web Component (ArkTS) Development 2 3## What is the domStorageAccess attribute of the \<Web> component used for? 4 5Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 6 7The **domStorageAccess** attribute specifies whether to enable the DOM Storage API, which is disabled by default and provides **localStorage**, but not **sessionStorage**. 8 9## How do I check the online status on the HTML page loaded by the \<Web> component? 10 11Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 12 131. Configure the **ohos.permission.INTERNET** and **ohos.permission.GET_NETWORK_INFO** application permissions. 14 152. Obtain the online status through **window.navigator.onLine** on the HTML page. 16 17## What should I do if the UserAgent string cannot be used in concatenation before the initial HTML5 page loading by the \<Web> component? 18 19Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 20 21By default, the **UserAgent** string is obtained through the **WebController**. A **WebController** object can control only one **\<Web>** component, and methods on the **WebController** can only be called by the **\<Web>** component bound to it. To concatenate the default **UserAgent** string and a custom string before the initial page loading, perform the following: 22 231. Use **@State** to define the initial **userAgent** and bind it to the **\<Web>** component. 24 252. In the **onUrlLoadIntercept** callback of the **\<Web>** component, use **WebController** to obtain the default **userAgent** string and modify the **userAgent** bound to the **\<Web>** component. 26 The code snippet is as follows: 27 28 29 ``` 30 @Entry 31 @Component 32 struct Index { 33 private controller: WebController = new WebController() 34 @State userAgentPa: string = '' 35 build() { 36 Row() { 37 Column() { 38 Web({ src: 'www.example.com', controller: this.controller }) 39 .width('100%') 40 .userAgent(this.userAgentPa) 41 .onUrlLoadIntercept((event) => { 42 let userAgent = this.controller.getDefaultUserAgent(); 43 this.userAgentPa = userAgent + ' 111111111' 44 console.log("userAgent onUrlLoadIntercept: " + userAgent); 45 return false; 46 }) 47 } 48 .width('100%').alignItems(HorizontalAlign.Start).backgroundColor(Color.Green) 49 } 50 .height('100%') 51 } 52 } 53 ``` 54 55## Should the logic for loading the lottie animation be written in the onAppear or onReady function? 56 57Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9 58 59The logic for loading the lottie animation must be written in the **onReady** function. The **onReady** function is triggered when the canvas is ready, while the **onAppear** function is triggered when the canvas is displayed. 60 61## Do I need to invoke the refresh API after invoking deleteJavaScriptRegister? 62 63Applicable to: all versions 64 65No. This operation is not needed. 66 67## How do I pass data from a page to the \<Web> component? 68 69Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 70 711. Use **WebController** to create two message ports: message port 1 and message port 0. 72 732. Send message port 1 to the HTML side, which can then save and use the port. 74 753. Register a callback for message port 0 on the application side. 76 774. Use message port 0 on the application side to send messages to message port 1 on the HTML side. 78 79Reference: [Web](../reference/arkui-ts/ts-basic-components-web.md#postmessage9) 80