在WebView调试的时候,有些链接是打不开的,比如wexin,alipay等等,所以这些链接需要打开的话可以使用外部浏览器来打开,不过没有使用官网文档的Intent的Action参数,而是使用下面的"android.intent.action.VIEW"来打开。
//弹出系统浏览器
Intent intent2 = new Intent();
Operation operation = new Intent.OperationBuilder()
.withDeviceId("")// 跳转的目的设备,空字符串表示本机
.withFlags(Intent.FLAG_NOT_OHOS_COMPONENT)
.withUri(Uri.parse("http://www.baidu"))
.withAction("android.intent.action.VIEW")
.build();
intent2.setOperation(operation);
getContext().startAbility(intent2, 0);
贴下官网文档的Action的参数链接,各位可以自己查看
https://developer.harmonyos/cn/docs/documentation/doc-referen


发布评论