比如,在原生的js中,可以使用如下代码实现:
function openApp(url) {
var ua = navigator.userAgent.toLowerCase();
var tb = url.replace("http://", "").replace("https://", "");
if( ua.match(/iphone os 9/i) == "iphone os 9" ) {
window.location = "taobao://" + tb;
window.setTimeout(function() {window.location = url;},4000);
}else{
var ifr = document.createElement('iframe');
ifr.src = 'taobao://' + tb;
ifr.style.display = 'none';
document.body.appendChild(ifr);
window.location = url;}}
//只在有优惠券的时候执行
openApp('https://item.taobao.com/item.htm?id=539608081526');
那么,在uniapp中,该如何实现?
2***@qq.com
// #ifdef APP-PLUS
var url = "market://details?id=io.dcloud.HelloH5";
plus.runtime.openURL( url );
// #endif
<navigator/> should have url attribute when using navigateTo, redirectTo or switchTab at uniapp://ready:191
一直报错
2018-10-25 20:51