openharmony 鸿蒙 changelog-web

2023-02-17 浏览 (1063)

Web Subsystem Changelog

Compared with earlier versions, OpenHarmony 4.0.2.2 has the following API changes in its web subsystem:

cl.web.1 Removal of webDebuggingAccess

The definition of the webDebuggingAccess API is inappropriate. This API should take effect for all Web instances. In light of this, it is removed and replaced by the new API setWebDebuggingAccess.

Change Impacts

This API must be deprecated and replaced with the setWebDebuggingAccess API.

Key API/Component Changes

ClassAPI TypeDeclarationChange Type
WebAttributemethodwebDebugggingAccess(webDebugggingAccess: boolean): WebAttributeDeleted

Adaptation Guide

Use the new API setWebDebuggingAccess.

cl.web.2 Adding of setWebDebuggingAccess

Added the static API setWebDebuggingAccess to WebviewController. It sets whether to enable web debugging works for all Web instances.

Change Impacts

The original webDebugggingAccess API must be replaced with the new API in the application.

Key API/Component Changes

ClassAPI TypeDeclarationChange Type
webview.WebviewControllermethodstatic setWebDebugggingAccess(webDebugggingAccess: boolean): voidAdded

Adaptation Guide

The following exemplifies how to enable web debugging:

// xxx.ets
import web_webview from '@ohos.web.webview';

@Entry
@Component
struct WebComponent {
  controller: web_webview.WebviewController = new web_webview.WebviewController();

  aboutToAppear():void {
    try {
      web_webview.WebviewController.setWebDebuggingAccess(true);
    } catch(error) {
      console.error(`ErrorCode: ${error.code},  Message: ${error.message}`);
    }
  }

  build() {
    Column() {
      Web({ src: 'www.example.com', controller: this.controller })
    }
  }
}

## 你可能感兴趣的鸿蒙文章

[harmony 鸿蒙Bundle Management Subsystem Changelog](/blog/1aeb192022cb485fbc890fb09daf5b1d) 

[harmony 鸿蒙Globalization Subsystem Changelog](/blog/fc7a824e896d43cca992a59ee5f519a5) 

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/c3aa95bcb446467e816b668f7896bf8d