uniapp 跳转默认浏览器及跳回当前app程序

发布时间 2023-03-24 10:45:09作者: LC蜗牛

跳转到默认浏览器,打开网站

// 仅在app中运行,且调用plus这个api
// #ifdef APP-PLUS
plus.runtime.openURL('https://uniapp.dcloud.net.cn', function(err) {
	uni.showToast({
		title: JSON.stringify(err),
		duration: 8000
	})
});
// #endif

网页跳转到uniapp app

首先需要配置一个唯一的key

源码视图

然后在需要跳转的网页里面,添加如下代码,打开真机调试,即可。
本地html文件运行到手机浏览器,不用发布,也可以跳转

// myuniapp 通过这个跳转 或者是通过window跳转
<a href="myuniapp://abc">test:<a><br/>

参考网址https://www.html5plus.org/doc/zh_cn/runtime.html#plus.runtime.openURL