JS方法如下,如有不懂可联系微信550707177一起交流
var wv, self;
mui.init();
mui.plusReady(function() {
self = plus.webview.currentWebview();
var e = "http://m.taobaygo.com/";
document.addEventListener("resume", function() {
plus.webview.currentWebview().close('slide-in-right')
}, false);
wv = plus.webview.create(e, "weburl", {
});
self.append(wv);
wv.addEventListener("loaded", function() {
var t = e.url;
//判断是否是淘宝链接
if(plus.os.name == "iOS") {
var tb =t.replace("https://","")
plus.runtime.launchApplication({
}, function(e) {
plus.nativeUI.confirm("检查到您未安装\"淘宝\",是否到商城搜索下载?", function(i) {
if(i.index == 0) {
iosAppstore("itunes.apple.com/cn/app/tao-bao/id387682726?mt=8");
}
});
});
}
});
}, false);
var first = null;
mui.back = function() {
wv.canBack(function(e) {
var canback = e.canBack;
if(canback) {
if(wv.getURL() == e) {
plus.runtime.quit(); //退出app
} else {
wv.back(); //返回上一页面
}
} else {
if (!first) {
first = new Date().getTime();
plus.nativeUI.toast("再按一次退出应用");
setTimeout(function() {
first = null;
}, 1000);
} else {
if (new Date().getTime() - first < 1000) {
plus.runtime.quit();
}
}}
});
}
});