I am developing a standalone application that also has a set of .php pages. Currently, I have placed these php files in .appcache manifest files and it works fine. But the problem is that although I'm online, when I try to access a php page, it loads the cached version. I prefer this kind of functionality,
- If online, connect to the server and download the latest information and overwrite the cached new information.
- If offline - show the latest updated html static page.
Here is my manifest file .appcache file
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 taskmanager.php does is read the tasks from the database and display them. When I cache it as above, it will always display a list of tasks when it was loaded for the first time. Even when I'm online, it does not call the database and does not receive new records. Instead, it is loaded from the cache. So my solution was to put it in the FALLBACK section, as mentioned in the first answer. Even if I put the taskmanager.php file in the FALLBACK section, as shown below,
FALLBACK taskmanager.php static_taskmanager.php
Now, if I have an Internet connection, taskmanager.php will be launched and will show me the latest tasks. But I want to make static_taskmanager so that it is in sync with these latest task sets. This means that when the user goes offline, static_taskmanager.php will show the most recent list of tasks that taskmanager.php returned when the user was online). But at the moment it works like a full static page.
- Can this be done?
- How can I solve this problem?
EDIT
As I understand it, browsing through SO and Google, one way to achieve this is to load dynamic content using AJAX. But I wonder if this can be done using only the manifest file itself.
source share