温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

HTML5怎么打开本地app应用

发布时间:2021-08-25 18:28:20 来源:亿速云 阅读:143 作者:chen 栏目:web开发

本篇内容介绍了“HTML5怎么打开本地app应用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

首先为了保证能够打开你的app,你必须要在androidManifest.xml中配置的filter中data的属性表述。

<data android:pathprefix="/taoge/open" android:scheme="xttblog"></data> androidManifest.xml代码如下:

XML/HTML Code复制内容到剪贴板

  1. <?xml version="1.0" encoding="utf-8"?>  

  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"  

  3.     package="com.taoge"  

  4.     android:versionCode="2"  

  5.     android:versionName="3.24.03" >  

  6.     <uses-sdk  

  7.         android:minSdkVersion="8"  

  8.         android:targetSdkVersion="17" />  

  9.     <application  

  10.         android:allowBackup="true"  

  11.         android:configChanges="orientation|screenSize"  

  12.         android:icon="@drawable/logo"  

  13.         android:label="@string/app_name"  

  14.         android:logo="@drawable/logo"  

  15.         android:sharedUserId="android.uid.system"  

  16.         android:theme="@android:style/Theme.Light.NoTitleBar" >  

  17.         <activity  

  18.             android:name="xttblog.WelcomeActivity"  

  19.             android:excludeFromRecents="true"  

  20.             android:screenOrientation="portrait"  

  21.             android:theme="@android:style/Theme.Light.NoTitleBar" >  

  22.             <intent-filter>  

  23.                 <action android:name="android.intent.action.MAIN" />  

  24.                 <category android:name="android.intent.category.LAUNCHER" />  

  25.             </intent-filter>  

  26.             <intent-filter>  

  27.                 <action android:name="android.intent.action.VIEW" />  

  28.                 <category android:name="android.intent.category.BROWSABLE" />  

  29.                 <category android:name="android.intent.category.DEFAULT" />  

  30.                 <data android:pathPrefix="/taoge/open"  

  31.                     android:scheme="xttblog" />  

  32.             </intent-filter>  

  33.         </activity>  

  34.         <activity  

  35.             android:name="xttblog.AntRepairActivity"  

  36.             android:label="@string/title_activity_ant_repair" >  

  37.         </activity>  

  38.     </application>  

  39. </manifest>  

其次,你要在你的网页中访问xttblog://taoge/open。可以使用的元素有很多,如:script,iframe,img等。使用它们的src属性,访问xttblog://taoge/open。html5代码如下:

XML/HTML Code复制内容到剪贴板

  1. <!DOCTYPE HTML>  

  2. <html>  

  3. <script>  

  4.  function openapp(){   

  5.   document.getElementById('xttblog').innerHTML='<iframe src="xttblog://taoge/open"></iframe>';   

  6.  }   

  7. </script>  

  8. <body>  

  9.  <div style="display:none;" id="xttblog"></div>  

  10.  <input type="button" value="打开app" onclick="openapp();">  

  11. </body>  

  12. </html>  

“HTML5怎么打开本地app应用”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI