HTML5: how to open a local app: html5app
This article shares with you how to open a local HTML5 app. The specific content is as follows:
First, to ensure that your app can be opened, you must specify the data attribute in the filter configured in androidManifest. xml. <Data android: pathprefix = "/taoge/open" android: scheme = "xttblog"> </data> the androidManifest. xml Code is as follows:
Copy XML/HTML Code to clipboard
- <? 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>
Secondly, you need to access xttblog: // taoge/open on your webpage. There are many elements available, such as script, iframe, and img. Use their src attribute to access xttblog: // taoge/open. The html5 code is as follows:
Copy XML/HTML Code to clipboard
- <! 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 = "open app" onclick = "openapp ();">
- </Body>
- </Html>
The above is all the content of this article, hoping to help you learn.