zoukankan      html  css  js  c++  java
  • 如何在HTML5页面中启动本地的App? 下面的方法应该可以。

    测试出来的基本思路是:

        1.Android Native App 开启URL调用

                

    <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协议无法支持,只能使用自定义的协议。

    2.页面中设置一下调用

    <!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>

    简单测试,妥妥的。如果应用已经安装,直接启动,如果没安装,跳到下载界面。

  • 相关阅读:
    【CQOI2015】网络吞吐量
    【SDOI2010】所驼门王的宝藏
    【NOIP2013】华容道
    【SNOI2019】通信
    【IOI2016】railroad
    【AtCoder3611】Tree MST
    【AtCoder2134】ZigZag MST
    【CF891C】Envy
    【BZOJ4883】棋盘上的守卫
    【CF888G】Xor-MST
  • 原文地址:https://www.cnblogs.com/yuxichina/p/3512371.html
Copyright © 2011-2022 走看看