Running JavaScript-enabled html documents as smart phone apps

Mobile version of this page


I am sure that this page is hopelessly out-of-date.  I confess, I mostly use my smartphone for making phone calls.  And I am still using a Galaxy S III Mini.  Intrepid users can surely figure out what to do with a modern phone.


Updated 10/7/2013 for Android 4

JavaScript-enabled html documents can be run as simple, cross-platform, smart phone apps.  Things have changed significantly since I originally wrote this page in 2011 using Android 2.2.1.  Here are some instructions for downloading and running html documents on a Samsung Galaxy S3 Mini with Android 4.2.2.

The condensed version:



• Download Dolphin Browser, UC Browser, and File Widget.

• Do your browsing and running of apps with Dolphin.

• When you come to a page that you want to save, use the Send to Browser add-on (from the Menu button) to send it to UC Browser.

• In UC Browser, use the Save Page add-on (from the little button at the upper right, beside the address bar) to save the page.  The default location is  /sdcard/UCDownloads, mirrored at  /storage/emulated/0/UCDownloads.

• Long-click the desktop and choose Apps and widgets, or just press the Apps desktop shortcut, and choose File Widget.  Drag it to a spot on the desktop.

• Select the file that you just saved by pressing the Pick File button.  The default location is the mirror at  /storage/emulated/0.  Open UCDownloads; the file you saved will have an .html extension.

• Enter a shortcut label.  The edit icon is useful as it lets you go back and change the shortcut’s title and other display options.  I like to use the Dolphin application icon.

• The shortcut will be created on your desktop.  Now all you have to do is open it using Dolphin.


       

Notes

Dolphin is the best Android browser for a number of reasons, not the least of which is that it handles advanced JavaScript effortlessly.  Having been around for a long time, it also has plenty of useful add-ons, such as Send to Browser.  It now has its own file browser as well, accessed from Menu — Downloads, so you don’t actually have to create desktop shortcuts if you don’t want to.

You can actually save html documents with Dolphin, just not the associated files such as images and css.  Long-click the link to a file, then select Save link; the default location is  /storage/emulated/0/download.

Dolphin Jetpack is a useful add-on for general browsing, but the link magnifier feature prevents some dynamic HTML events.  It may have to be disabled to use some pages.

UC Browser is the only one that I know of that saves entire web pages, including the html document and associated files, in their native formats.  And it does it simply and easily.  It is a good all-around web browser, also with its own file browser, and seems to be able to handle JavaScript; but it has some trouble rendering all of the dynamic html and css.  Of note, it saves html documents as they are rendered, including scripted elements, not the raw html file on the server the way desktop browsers do.  I updated The Virtual Yarrow Stalks I Ching on 10/11/2013 to account for this issue.

The only other browsers that I know of that save entire web pages are Opera Classic and Opera Mini.  But the documents are saved in proprietary formats that are not readable by other browsers.  And no version of Opera that I have ever used, either mobile or desktop, is reliable with advanced JavaScript.

Other browsers that seem to handle advanced JavaScript and dynamic HTML, and would be alternatives to Dolphin, are Baidu, Boat Browser, iLunascape, Maxthon, and Next Browser.  Boat Browser and iLunascape can save web pages, but only the html document, not the associated files.  Firefox and ONE Browser do almost everything, but are lacking a little in their HTML display abilities.  In addition, Firefox is slow; it takes up to 18 seconds to render the large fractal table in the Fractal I Ching, while most of the others take only 5 or 6.  Angel and Sleipnir are not up to the task.  And Chrome, Ninesky, and Puffin do not integrate into File Widget or the file managers described below, and so cannot be used to open saved files.

The browsers above are all free.  xScope Browser ($2.99) has a lot of potential for being an all-in-one browser and file manager, if it would only download files like UC Browser.  Otherwise, it seems fully functional.

Other applications for creating desktop shortcuts include File Shortcut, ASTRO File Manager, and ES File Explorer.  They all have their own issues.  File Shortcut works o.k., but has fewer options than File Widget, the main one being that shortcuts cannot be edited after they are created.  Also, it cannot create a shortcut to a folder; File Widget comes with Folder Widget to do just that.  Dolphin will open ASTRO shortcuts, while UC Browser won’t.  And ASTRO seems to be a little outdated; it crashes now and then, such as when creating a shortcut after the file view option is changed from Grid to List.  And the crash may reset all of your ASTRO shortcuts, along with their titles, to default ASTRO icons.  Neither Dolphin nor UC Browser will open the shortcuts created by ES File Explorer.

A number of other applications are available for saving web pages for offline viewing.  I prefer UC Browser to all of them; it is easier to use, and the downloaded files are easy to identify.  Of the others, OffLine Browser by NiKoDroid70 is probably the best.  All files are saved, including images, .css, and .js; they are easy to find (/storage/emulated/0/OffBrowser), although not intiutively named; and when using the app, the pages can be opened in any browser by using Share Page.  Offline Browser by Theis Borg (/storage/emulated/0/websnake) simply numbers all the supporting files without extensions, so they cannot be opened by themselves; and the app only provides a choice between the inline or default browsers.  Save This Page (/storage/emulated/0/Android/data/com.envisinex.savethispage) saves all the files o.k., but doesn’t offer download options like the others do, nor any choice of browser using the app.  Web page downloader (/storage/emulated/0/Android/data/jp.gr.java_conf.appdev.app.htmldownload) saves all the files in date-stamped folders, and any browser can be used from the app by using Open downloaded page; but the interface is a little confusing.  Read Web Offline (/storage/emulated/0/cacheRwo) only saves the html document and images, no other supporting files; and apparently does not save the html in Unicode format, as special charactes such as bullets are garbled.  And Offline Browser by NM MOBILE crashes when saving; I haven’t been able to use it.



 


Archive, the original page from 2011

I have been asked if two of my JavaScript applications (Optical Print Centering and The Virtual Yarrow Stalks I Ching) could be made into smart phone apps.  I figured that it would only be a matter of time before mobile phones and browsers acquired the ability to open and run these documents offline, and I kept telling myself that when that day arrived, I would break down and get a smart phone.  Well, it has finally happened, and I am now the proud owner of a Pantech Crossover running Android 2.2.1.  (To repeat what has already been said online:  pros, the slide-out keyboard; cons, everything else.)  I have found two fairly easy ways to open and run the above scripts using free Android apps; here they are.


Method 1:  use Dolphin Browser (I used Mini) together with ASTRO File Manager.  If you use Dolphin to save an online html document (web page) to the phone, you can reopen it, and even bookmark it, for offline use.  But if you copy a document to your phone by some other means, there is no way that I could find to use Dolphin to open it by itself; this is where ASTRO comes in.  You can use ASTRO to browse the directories on your phone and SD card; and when you select a file, you are presented with a list of what ASTRO considers appropriate apps with which to open it.  Dolphin integrates readily with ASTRO, and can be set as the default application for the file.  See the screenshots below.  I had used Dolphin to download Optical Print Centering from the web; the file was in Dolphin’s download folder.  When the folder is opened with ASTRO, and the file selected, simply choose Dolphin to complete the action, and the page opens.  The script is fully functional; one simply has to get used to the tiny screen.

     


Method 2:  use xScope Browser - Web & File.  This web browser is also its own file browser, so no second application is needed.  I ran into one glitch:  the Viewport setting in the Settings menu must be changed from the default “normal” to “wide” for the JavaScript to function properly with non-mobile-optimized pages; if the page is single-column and designed for mobile, this does not appear to be an issue.  Having done this, one simply chooses the Files menu and navigates to the desired file.  I had copied Virtual Yarrow Stalks directly to Dolphin’s download folder; Dolphin did not find it in its own download menu (hence the need to use ASTRO as above), but xScope navigated to either document without difficulty.  Once again, the script was fully functional.

     


Issues with the above

One advantage to method 1 is that ASTRO will open zipped files, including the Virtual Yarrow Stalks zipped download; the free version of xScope will not.  Plus, ASTRO is a handy app to have anyway.  Another utility app with a file browser is Android Assistant; it functions similarly, and opens zipped files.

One problem with the above methods is that, while both browsers (as well as Dolphin Browser HD) can save online web pages to the phone, they only save the html document, not the associated files such as images and css.  Apps such as Save This Page and Offline Browser can act as plugins for each of the browsers, and are intended to save the complete page; but in my case neither of them saved the background image, and neither of them saved the page in its original form.  (Opera does a better job, but has its own problems as described below.)  The scripts referenced above are text-only and were intended from the start to be downloaded and used offline; but other pages may not be.  So, for this reason, and possibly to save bandwidth with large files, one may need to save online pages with a conventional computer and desktop browser, and then transfer them to the phone or SD card to be opened with ASTRO/Dolphin or xScope.

Tip:  you can add a Dolphin HD (apparently not Dolphin Mini) or an ASTRO shortcut to the desktop for easy access; these can be shortcuts to offline files stored on the phone.

Issues with other browsers

Boat Browser Mini can be used with ASTRO like Dolphin can, and would be a suitable alternative.  But I don’t like the appearance as much; and, as there is no “save file” option, Save This Page or Offline Browser may have to be used along with it.

I tried five other browsers:  Miren, Angel, Opera Mobile, Opera Mini, and Skyfire, in addition to the phone’s default browser (“Web”); none of them is currently suitable as a general-purpose offline JavaScript platform, each for its own reasons:

Miren and Angel work with ASTRO like Dolphin does; but they do not display the non-ASCII characters in the text (such as smart quotes and em dash) unless the character set is either UTF-8 or iso-8859-1 (windows-1252, which is very common, does not work); so I consider them to be “close, but no cigar.”  Also, Miren has no “save file” option.  Angel can be used to save files via the Read Later menu, but it corrupted my files in the process.

Opera Mobile has one major advantage over Dolphin and xScope:  it can save a complete page, including images and other associated files, as an .mhtml archive in the SD card’s Download folder.  But, sadly, it cannot handle all of the JavaScript; it seems to do o.k. with Optical Print Centering, but not Virtual Yarrow Stalks.  (Opera Mini cannot handle either one.)  Additionally, only Opera will open its .mhtml archives; when using ASTRO, the file opens with Opera automatically, Dolphin is not a choice; and xScope navigates to it but is unable to open it.  (Opera is not fully integrated into ASTRO, as it is not presented as a choice to open ordinary html files.)

Skyfire and Web work fine online; but like xScope and both Operas, they are not integrated into ASTRO, and so cannot be used to open pages saved to the phone or SD card.  As with Miren, there is no “save file” option.

Conspicuous by its absence is Firefox Mobile; it hasn't caught up with the Pantech Crossover yet.  There are a handful of other browsers out there; I will leave them for others to test.

Wish list

Someday, maybe there will be a mobile browser with all of the following features:

• a fully-functional JavaScript engine and html/css rendering capability
• file-browsing and file-opening capability
• the ability to open archives such as .zip and .mht
• the ability to save complete pages, including supporting files
• the ability to create desktop shortcuts to saved files

Those other phones

Not that I am biased against a crassly commercial and overly-restrictive product like the iPhone, but . . . I see that there are some alternative web and file browsers for that illustrious instrument as well, and I am sure that owners of these and other smart phones will find ways to use offline html documents as I have on my Android.  After all, the main advantage of JavaScript applications is that they are cross-platform.  logos


The Virtual Yarrow Stalks I Ching | Optical Print Centering
The Mobile Zone Calculator | The Mayan Long Count Calendar | The Lithium Calculator

www.russellcottrell.com | Mobile version of this page