HTML5: how to open a local app: html5app

Source: Internet
Author: User

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

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
  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 = "open app" onclick = "openapp ();">
  11. </Body>
  12. </Html>

The above is all the content of this article, hoping to help you learn.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.