evothings / evothings-client

This repository is no longer maintained.
Apache License 2.0
6 stars 13 forks source link

Clearing the WebView cache #71

Closed ghost closed 9 years ago

ghost commented 9 years ago

Problem:

When using Evothings Client as a browser for IoT apps, the cache is not cleared when updating files on the web server. Thus, the new version of the app does not run, but the old one.

This is clearly a problem.

Possible solutions:

Make the WebView not cache anything.

Make a "Clear Cache" button on the Evothings Client start screen.

Add meta tags to the HTML file(s), e.g. like this:

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

Further info on the meta tags:

ghost commented 9 years ago

Researched the problem. Findings:

The following meta tags solved the problem:

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />

Eventually it would be useful to make a setting on in Android WebView to turn off caching, but that would be done as new development activity rather than as part of this issue.

Updated this documentation page with info about solutions to caching problems:

http://evothings.com/doc/build/share-apps.html

Documentation pull request:

https://github.com/evothings/evothings-doc/pull/52