I am developing an offline application which has a set of .php pages too. Currently I have put those php files in a .appcache manifest files and it works fine. But the issue is, even though I am online, when I try to access a php page, it loads the cached version. What I prefer is a functionality like this,
- If online - connect to the server and load the up to date information, and overwrite the cached one with new information.
- If offline - show the last updated static html page.
Here is my .appcache manifest file content
CACHE MANIFEST
#2
taskmanager.php
public/css/bootstrap.css.map
public/css/bootstrap.min.css
public/css/bootstrap-theme.css.map
public/css/bootstrap-theme.min.css
public/css/main.css
public/css/task-manager.css
public/js/app.js
public/js/taskmanager.js
public/js/offlink.js
public/js/jquery-2.1.4.js
public/js/bootstrap.min.js
NETWORK:
*
http://*
What the taskmanager.php do is read tasks from a database and show it. When I cache it like above, it will always show the list of tasks when it was loaded form the first time. Even when I am online, it does not call the database and get the new entries. Instead it is loaded from the cache. So, my solution was to put it in the FALLBACK section as mentioned by the first answer. Even if I put the taskmanager.php file under the FALLBACK section like below,
FALLBACK
taskmanager.php static_taskmanager.php
Now, if I have internet connection, taskmanager.php will run and will show me the latest tasks. But I want to make static_taskmanager in such a way that it will be synchronized with those latest set of tasks. Which means, when the user goes offline, static_taskmanager.php will show the most recent list of tasks which was returned by the taskmanager.php when the user was online). But at the moment it works as a complete static page.
- Is it possible to do this?
- How can I address this issue?
EDIT
As I understood by searching over SO and Google, one way of achieving this is load the dynamic content using AJAX. But I wonder is it possible to do by using only the manifest file itself.