Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5 offline caching with php driven sites

I have a simple php driven website running and I'm trying to figure out how it treats php pages. Some of my php documents are routing logic and some just includes for individual pages. How do i go about making this work offline?

What I though was that I'd have to re-create the routing logic in javascript. Is that my only option? In that case, is it even possible to have the site be driven by php while online and switch to JS offline? I can't make sense of it.

like image 905
Serg Chernata Avatar asked Oct 07 '10 20:10

Serg Chernata


People also ask

What allows html5 application to work in an offline state?

The Application Cache (or AppCache) allows a developer to specify which files the browser should cache and make available to offline users. Your app will load and work correctly, even if the user presses the refresh button while they're offline.

What does the section cache do in a manifest file?

The CACHE section contains files you want to load and store on the user's machine. The first time the user loads your app, the browser will store all the files in the CACHE section of your app cache manifest. The NETWORK section contains all the resources that require a network connection to be loaded.

What instructs the browser to store certain files locally to allow the user to continue working without the connection?

4. The manifest tells the browser which files to store locally so the user can continue working without a network connection.


1 Answers

If your site is fairly static, HTML5's cache manifest may get you most of the way there. Have PHP output a cache.manifest file in the correct format with all your routing system's URLs and those URLs will be stored locally in a compliant browser. Attempting to access them will pull them out of the cache if possible.

If you're looking for something more dynamic, though, you're going to have to do more legwork.

Here's some good info on offline caching.

like image 85
ceejayoz Avatar answered Oct 02 '22 20:10

ceejayoz