測試出來的基本思路是:javascript
1.Android Native App 開啓URL調用html
<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="http" android:host="192.168.1.81" android:path="/sorinda/index.htm"/> <data android:scheme="stc" /> </intent-filter>
Andorid 4.0的系統親測,HTTP協議沒法支持,只能使用自定義的協議。java
2.頁面中設置一下調用android
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript"> function showUrl() { document.getElementById('tt').addEventListener('load', showDown); document.getElementById('tt').src = 'stc://192.168.1.81/sorinda/index.htm'; return false; } function showDown() { window.location = "download.html"; } </script> </head> <body> <a href="#" onclick="showUrl()">downapp</a> <iframe id="tt" width=0 height=0 ></iframe> </body> </html>
簡單測試,妥妥的。若是應用已經安裝,直接啓動,若是沒安裝,跳到下載界面。app