**注:目前已测的只有安卓端 其他相关后续补充
首先,wap的HTML页面
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="m://my.com/">打开app</a><br/>/**传参的话,格式m://my.com/?action=1**/
</body>
</html>
在Android本地app的配置在
AndroidManifest的清单文件里的intent-filte中加入如下元素:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="my.com"
android:scheme="m" />
</intent-filter>
配置完成后,即可通过wap端去打开APP。(如果手机中没有安装你的APP,点击是没有效果的)
据我了解,Android当前没有直接的js判断是否安装了APP。所以实现没有APP就弹出下载的方法不太完善
以下是判断方法
if(navigator.userAgent.match(/android/i)){
function android(){
window.location.href = "m://my.com/";
// **打开app的协议,没有APP时该项不做反应**
setTimeout(function(){
window.location.;
/***弹出下载项,注:此处的下载项,如果是APk包的下载链接,则本页弹出下载选项,否则会跳转页面***/
},2000);
};
}
點(diǎn)擊查看更多內(nèi)容
1人點(diǎn)贊
評(píng)論
評(píng)論
共同學(xué)習(xí),寫下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦