HTML Doc

buzztouch plugin: HTML Doc
Version: v1.6
HTML documents can be included in the project and compiled in the application or they can be downloaded from a URL when the app runs. If they are downloaded from a URL they are cached on the device for offline use.
works on iOS iOS
works on Android Android
Latest Review
Pointerfarcat | 01/23/14 (v1.6)
Bread and butter sort of plugin. Works well.
Screenshots
More Information
This displays an HTML document that is either compiled in the Xcode or Android project or
loaded from a URL. If the document is loaded from a URL the device will cache it for offline use.
If the document is compiled in the app (and not loaded from a URL) it will display faster but you
will not be able to change the document without re-compiling the app. Deciding which approach is
best is sometimes difficult. It's usually best to load a document from a URL so the application
is lighter, more flexible, and updateable.

Launch in Native Browser: If you turn this option on in the advanced settings you must use the URL
option, local files cannot load in the device's native browser. Android: Most native browsers
on Android cannot display documents of this type and will download the document to the users
device instead.

Images: If you use a document that is compiled in the App, and that included images, you'll need
to include the images in the project. You'll also need to make sure the image tags in the HTML use
the appropriate src attribute. For HTML docs compiled in projects, the src attribute includes only
the images file name, like this: src='myimage.png' Alternatively, you could use fully
qualified URL's for image src attributes like this: src='http://www.mydomain.com/myimage.png'

Javascript: If the HTML document uses javascript, for best results, include it in the HTML <head> section.
You can also use external javascript files but many app owners struggle with this. There are some gotcha's
about how iOS and Android handle these files so you may end up doing some hacking to get external .js files
to work as expected.


iOS Project
------------------------
1 Objective-C class (a total of 2 files) are needed.
BT_screen_htmlDoc.m and .h

BT_screen_htmlDoc.m is a UIViewController with a UIWebView used to display the file.

Android Project
------------------------
1 .java class file is needed, 1 layout xml file is needed, and 1 image is needed (a total of 3 files)
BT_screen_htmlDoc.java
screen_htmldoc.xml
screen_htmldoc.png

BT_screen_htmlDoc.java is an Android Activity that serves as a landing screen with two buttons and a
graphic. Open or Download. The screen_htmldoc.xml file handles the layout. A landing screen is
necessary because Android cannot display this type of document natively. When the Open button is used
the device will determine which application to display the document with.

Version History
-----------------
v1.6     1/8/2014
          Updated for Buzztouch 3.0 control panels. (Chris1)

v1.3     11/10/2012
          Minor syntax changes to accomodate for Xcode 4.5 compiler warnings.
          Minor changes in .java files to accomodate for Anroid (Google) 2.2 API's compiler warnings.
          Minor UI changes in .php files for control panel.

v1.0, 1.1, 1.2 (historical versions, no change details)


JSON Data
------------------------

Most folks use the control panel to configure the JSON data for this plugin but it's useful to
see what it may look like. This example loads a document from a URL

{
     "itemId":"343434",
     "itemType":"BT_screen_htmlDoc",
     "navBarTitleText":"HTML Doc",
     "dataURL":"http://www.mydomain.com/sample.html"
}

This example loads a document from the applications bundle (compiled in Xcode or Eclipse). Note
that a localFileName is used instead of a dataURL.

{
     "itemId":"343434",
     "itemType":"BT_screen_htmlDoc",
     "navBarTitleText":"HTML Doc",
     "localFileName":"sample.html"
}