HarmonyOS web组件不支持自动跳转其他app

应用内置的web组件在重定向至类似store://xxxxx时候无法自动跳转至应用市场

系统的浏览器是可以自动跳转的,应用内部的web组件无法自动跳转

目前这种情况是否只能通过want跳转

HarmonyOS
2024-12-25 14:00:03
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

应用内web跳转,目前只能通过want。直接通过window.location.href = 'store://appgallery.huawei.com/app不行,但可以web拦截后拉起。

以下是简单例子:

Web({ src: $rawfile('call.html'), controller: this.controller })
  .onLoadIntercept((event) => {
    if (event) {
      let url: string = event.data.getRequestUrl();
      if (url.indexOf('store://') === 0) {
        const want: Want = {
          uri: `store://appgallery.huawei.com/app`
        }
        const context = getContext(this) as common.UIAbilityContext;
        context.startAbility(want).then(() => {
        }).catch(() => {
        })
        return true;
      }
    }
    return false;
  })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
分享
微博
QQ
微信
回复
2024-12-25 17:03:14
相关问题
web组件不支持localstorage
1489浏览 • 1回复 待解决
RelativeContainer容器不支持自动宽高
954浏览 • 1回复 待解决
HarmonyOS Web不支持http请求,只支持https
1020浏览 • 1回复 待解决
HarmonyOS RNOH Image组件不支持apng
669浏览 • 1回复 待解决
Refresh组件不支持设置nestedScroll属性
2715浏览 • 1回复 待解决
HarmonyOS 编码集不支持
757浏览 • 1回复 待解决
HarmonyOS 推送设备不支持
797浏览 • 1回复 待解决
Toggle isOn不支持$$?
785浏览 • 1回复 待解决
HarmonyOS如何跳转其他app
1108浏览 • 1回复 待解决
Image组件不支持读入沙盒内的图片
1627浏览 • 1回复 待解决
Image组件不支持svg字符串显示
1083浏览 • 1回复 待解决
HarmonyOS Span不支持n换行
733浏览 • 1回复 待解决
HarmonyOS image不支持mask吗
805浏览 • 1回复 待解决
HarmonyOS @State不支持HashMap吗
735浏览 • 1回复 待解决
HarmonyOS color文件不支持rgba吗
770浏览 • 1回复 待解决
HarmonyOS ArkTD不支持any,如何替换
718浏览 • 1回复 待解决
HarmonyOS RN使用datetimePicker显示不支持
745浏览 • 1回复 待解决