Update html 5 using appcache user control

I am working on an ipad webapp that will receive monthly changes. However, I cannot figure out how to allow the user to decide whether to update the cache or not. The iPad tends to just go ahead and update when it notices a manifest file change. I would like to prevent this, so users who have not finished reading this monthly version can be updated when they like it. I was looking for a solution to this question, but I did not find any useful information.

As my application is configured, I have a content page that retrieves data from the database, and all other files (upload from media added to the content page) is static.

I have cache.manifest with every file in it, and the version number is automatically changed when updating at the top of the comment.

Thus, updating the content means a new manifest, which means that the updateReady event is fired. If anyone could give me any instructions on how to catch this and prevent it from automatically switching to the new version, that would be nice.

Thank!

+3
source share
1 answer

How to stop the application update?

When the application is offline, it remains cached until one of the following events occurs:

  • The user clears the repository of their browsers for your site.
  • . . , , , . .
  • .

http://www.html5rocks.com/tutorials/appcache/beginner/#toc-updating-cache

: .

?

-, , URL- :

<html manifest="manifest.php?version=2">

URL manifest.php?version=2 , , ( ). Script :

<?php

    header ( "Content-Type: text/cache-manifest" ) ;

    echo "CACHE MANIFEST\n\n" ;

    echo "# version " . $_GET [ "version" ] . "\n" ;

    echo "index.php\n" ;
    echo "styles.css\n" ;
    echo "scripts.js\n" ;

?>      

, URL-, manifest.php?version=5?

manifest window.applicationCache.update() URL.

:

  • , ;
  • , cookie ( "wish_to_update = 1" );
  • manifest.php read cookie , ;

manifest.php:

if ( $_COOKIE [ "wish_to_update" ] == "1" )
{
    // generate modified version
    echo "# version another than in your URL" ;
    setcookie ( "wish_to_update", "0" ) ;
 }
 else
 {
    // generate unmodified version
    echo "# version " . $_GET [ "version" ] . "\n" ;
 }
  • .
+3

All Articles