HarmonyOS 元服务中使用隐式want的方式启动浏览器报错

HarmonyOS 元服务中使用隐式want的方式启动浏览器报错。

HarmonyOS
2024-11-21 11:50:02
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa
module.json5 
"skills": [ 
{ 
  "entities": [ 
  "entity.system.home", 
  "entity.system.browsable" 
  ], 
  "actions": [ 
  "action.system.home", 
  "ohos.want.action.viewData" 
  ], 
  "uris": [ 
  { 
    "scheme": "https", 
  "host": "www.huawei.com" 
  } 
 
  ] 
} 
]
xxx.est 
Button("拉起浏览器").onClick(() => { 
  let want: Want = 
    { 
      action: 'ohos.want.action.viewData', 
      entities: ['entity.system.browsable'], 
      uri: 'https://www.huawei.com/' 
    }; 
  this.context.startAbility(want).then(() => { 
    console.log('成功') 
  }).catch((err: BusinessError) => { 
    console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); 
  }); 
})
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.

​参考地址:​https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-inner-ability-want-V5

分享
微博
QQ
微信
回复
2024-11-21 15:42:52
相关问题
HarmonyOS 启动默认浏览器
1526浏览 • 1回复 待解决
HarmonyOS 服务中使用axios报错2300028
906浏览 • 1回复 待解决
服务卡片webview如何跳转系统浏览器
8869浏览 • 2回复 待解决
HarmonyOS跳转系统浏览器打开网页报错
1862浏览 • 1回复 待解决