HarmonyOS web组件加载网页显示空白?

web组件加载网页显示空白,系统浏览器可以正常加载

阅读 487
1 个回答

请尝试添加.javaScriptAccess(true) .fileAccess(true) .domStorageAccess(true)

若网页不适配请添加以下代码:

.onControllerAttached(()=>{
  this.controller.setCustomUserAgent("Mozilla/5.0 (Phone; Android; OpenHarmony 4.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 ArkWeb/4.1.6.1 Mobile")
})