Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14746

Android: HTML5 app cache (using manifest)

    Details

      Description

      Description

      Support for HTML5 app cache (using manifest) for Titanium's webview for Android.

      Test case

      The test case needs a client and a server. Once the files are created, follow these steps:

      1. be sure the device is online, then open the app: you would see 2 images in the webview
      2. turn off network on the device
      3. hit reload in the app: only one image should be shown (the first) as it is the only one cached

      Test code

      Client side

      app.js

      var win = Ti.UI.createWindow({
      	backgroundColor: 'white'
      });
       
      var web = Ti.UI.createWebView({
      	url: 'http://example.com/index.html',
      	left: 0,
      	right: 0,
      	top: 0,
      	bottom: 100
      });
       
      var btn = Ti.UI.createButton({
      	title: "Refresh",
      	bottom: 0
      });
       
      btn.addEventListener('click', function() {
      	web.reload();
      });
       
      win.add(btn);
      win.add(web);
      win.open();
      

      Server side

      example.manifest

      CACHE MANIFEST
      # v1 - 2011-08-13
      http://example.com/index.html
      http://example.com/image.php
      

      index.html

      <html manifest="example.appcache">
      <head>
      <body>
      	<img src="image.php" />
      	<img src="imagenocache.php" />
      </body>
      </html>
      

      image.php and imagenocache.php

      <?php
      // make sure the file is not cached
      header("Content-Type: image/jpg");
      header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
      header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
       
      echo file_get_contents("image.jpg", "r");
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sunila Sunila
                Reporter:
                rsharma Rupesh Sharma
                Reviewer:
                Hieu Pham
              • Watchers:
                8 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration