当前位置:   article > 正文

鸿蒙应用开发之跳转系统浏览器打开链接_鸿蒙开发 调用系统浏览器

鸿蒙开发 调用系统浏览器
static async openSystemBrowser(url: string) {
   if (url) {
     try {
       let want = {
         // uncomment line below if wish to implicitly query only in the specific bundle.
         // bundleName: "com.example.myapplication",
         "action": "ohos.want.action.viewData",
         // entities can be omitted.
         "entities": ["entity.system.browsable"],
         "uri": url,
         "type": "text/plain"
       }
       let context = getContext(this) as common.UIAbilityContext;
       await context.startAbility(want)
       console.info(`explicit start ability succeed`)
     } catch (error) {
       console.info(`explicit start ability failed with ${error.code}`)
     }
   }
 }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/339231?site
推荐阅读
相关标签
  

闽ICP备14008679号