HTML5打開(kāi)本地app應(yīng)用的方法
本文為大家分享了HTML5打開(kāi)本地app應(yīng)用的方法,具體內(nèi)容如下
首先為了保證能夠打開(kāi)你的app,你必須要在androidManifest.xml中配置的filter中data的屬性表述。<data android:pathprefix="/taoge/open" android:scheme="xttblog"></data> androidManifest.xml代碼如下:
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.taoge"
- android:versionCode="2"
- android:versionName="3.24.03" >
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
- <application
- android:allowBackup="true"
- android:configChanges="orientation|screenSize"
- android:icon="@drawable/logo"
- android:label="@string/app_name"
- android:logo="@drawable/logo"
- android:sharedUserId="android.uid.system"
- android:theme="@android:style/Theme.Light.NoTitleBar" >
- <activity
- android:name="xttblog.WelcomeActivity"
- android:excludeFromRecents="true"
- android:screenOrientation="portrait"
- android:theme="@android:style/Theme.Light.NoTitleBar" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.BROWSABLE" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:pathPrefix="/taoge/open"
- android:scheme="xttblog" />
- </intent-filter>
- </activity>
- <activity
- android:name="xttblog.AntRepairActivity"
- android:label="@string/title_activity_ant_repair" >
- </activity>
- </application>
- </manifest>
其次,你要在你的網(wǎng)頁(yè)中訪問(wèn)xttblog://taoge/open。可以使用的元素有很多,如:script,iframe,img等。使用它們的src屬性,訪問(wèn)xttblog://taoge/open。html5代碼如下:
- <!DOCTYPE HTML>
- <html>
- <script>
- function openapp(){
- document.getElementById('xttblog').innerHTML='<iframe src="xttblog://taoge/open"></iframe>';
- }
- </script>
- <body>
- <div style="display:none;" id="xttblog"></div>
- <input type="button" value="打開(kāi)app" onclick="openapp();">
- </body>
- </html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助。
相關(guān)文章
淺談html5與APP混合開(kāi)發(fā)遇到的問(wèn)題總結(jié)
這篇文章主要介紹了淺談html5與APP混合開(kāi)發(fā)遇到的問(wèn)題總結(jié)的相關(guān)資料,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-03-20Html5 APP中監(jiān)聽(tīng)返回事件處理的方法示例
這篇文章主要介紹了Html5 APP中監(jiān)聽(tīng)返回事件處理的方法示例的相關(guān)資料,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-03-15使用html5新特性輕松監(jiān)聽(tīng)任何App自帶返回鍵的示例
這篇文章主要介紹了使用html5新特性輕松監(jiān)聽(tīng)任何App自帶返回鍵的示例的相關(guān)資料,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-03-13- 這篇文章主要介紹了HTML5頁(yè)面中嘗試調(diào)起APP功能,需要的朋友可以參考下2017-09-12
HTML5 Plus 實(shí)現(xiàn)手機(jī)APP拍照或相冊(cè)選擇圖片上傳功能
這篇文章主要為大家詳細(xì)介紹了HTML5 Plus的Camera、GalleryIO、Storage和Uploader,實(shí)現(xiàn)手機(jī)APP拍照或相冊(cè)選擇圖片上傳功能的相關(guān)資料,感興趣的小伙伴們可以參考一下2016-07-13
html5調(diào)用app分享功能示例(WebViewJavascriptBridge)
這篇文章主要介紹了html5調(diào)用app分享功能示例(WebViewJavascriptBridge)的相關(guān)資料,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-03-21


