本文为大家分享了html5打开本地app应用的方法,具体内容如下
首先为了保证高一成绩能够打开你的宜兴中学app,你必须要在androidmanifest.xml中配置的filter中data的属性表述。<data android:pathprefix=”/taoge/open” android:scheme=”xttblog”></data> androidmanifest.xml代码如下:
xml/html code
复制内容到剪贴板
<?xmlversion=“1.0”encoding=“utf-8”?> <manifestxmlns:android=“http://schemas.android.com/apk/res/android” package=“com.taoge” android:versioncode=“2” android:versionname=“3.24.03”> <us-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:sharedurid=“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> <actionandroid:name=“android.intent.action.main”/> <categoryandroid:name=“android.intent.category.launcher”/> </intent-filter> <intent-filter> <actionandroid:name=“android.intent.action.view”/> <categoryandroid:name=“android.intent.category.browsable”/> <categoryandroid:name=“android.intent.category.default”/> <dataandroid:pathprefix=“/taoge/open” android:scheme=“xttblog”/> </intent-filter> </activity> <activity android:name=“xttblog.antrepairactivity” android:label=“@string/title_activity_ant_repair”> </activity> </applicat陕西十大名校ion> </manifest> 其次,你要在你的网页中访问xttblog://taoge/open。可以使用的元素有很多,如:script,iframe,img等。使用它们的src属性,访问xttblog://taoge/open。html5代码如下:
xml/html code
复制内容到剪贴板
<!doctypehtml> <html> <script> functionopenapp(){ document.getelementbyid(‘xttblog’).innerhtml=‘<iframesrc=”xttblog://taoge/open”></iframe>’; } </script> <body> <divstyle=“中文文秘类包括哪些专业display:none;”id=“xttblog”></div> <inputtype=“button”value=“打开app”onclick=“openapp();”> </body> </html> 以上就是本文的全部内容,希望对大家的学习有所帮助。