webapp經過JS代碼與移動APP交互

複製地址:http://blog.csdn.net/sky_monkey/article/details/22938125css

<span style="font-size:18px;"><script>  
function startAPP(){  
window.location = "**://**.**/**";  
}  
function downloadAPP(){  
window.location = "http://IP/**/**.apk";  
}  
 
</script>  
<style type="text/css">  
        body{background:#D2D460;text-align:center;margin-top:10%}  
        div{width:100%;margin:0 auto;background:#fff;text-align:left;}  
</style>  
</head>  
<body>  
<img src=images/start.png alt=打開APP onclick=startAPP() ></img>
<img src=images/download.png alt=打開APP onclick=downloadAPP() ></img>
<img src=images/welcome.png alt=打開APP onclick=startAPP() ></img>
</body></html>html


在app裏面須要作如下設置(通常是在manifest.xml文件的activity的 intent filter裏面)android

    <span style="font-size:18px;"><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:scheme="**"   
                android:host="**.**"   
                android:pathPrefix="/**">  
             </data>  
    </intent-filter></span> 

app

相關文章
相關標籤/搜索