8

The issue the question originates from is the following. I'm using TiddlyWiki (Classic) SPA on my Android device and usually use it with FireFox and its TiddlyFox extension for saving. For some reasons I'd like to be able to work with (and save) my TWs using other browsers, so I'm testing it with a PHP back-end (my fork of MicroTiddlyServer, but its code is not important here, I believe, + this PHP server).

In my tests I've noticed that although saving works fine, sometimes (at least when the PHP server is unloaded from memory due to this ugly Android "optimization" which seems to be not configurable) a TW is loaded from cache and because of that it is loaded as it was before the latest saving, not after.

So, what I want is to detect if the page was loaded in an ordinary way or from browser cache. Is it possible to check this via JavaScript?

As a worse alternative I can inject a timestamp via MTS and check it in a TW on load, but I'd like to avoid this complication (which involves both front-end and back-end and adds more TW file manipulation).

user1219801
  • 159
  • 2
  • 17
YakovL
  • 5,213
  • 10
  • 46
  • 71
  • 1
    It looks duplicated, have you checked http://stackoverflow.com/questions/9870332/detecting-browser-cache-by-jquery and http://stackoverflow.com/questions/260043/how-can-i-use-javascript-to-detect-if-i-am-on-a-cached-page – Paulo Prestes May 25 '16 at 00:33
  • (I've ended up with adding appropriate headers to the PHP part so that the page is always served without cache) – YakovL Jan 29 '18 at 16:53

1 Answers1

0

If you use the remote debugger in chrome you can see the network requests and determine if you item is cached or not. Firefox seems to have a remote debugger as well.

alanmbarr
  • 42
  • 2
  • 7
  • Unfortunately, I'm looking for a way to do this via JavaScript (so that I can notify the user), preferrably without any additional action from back-end (I'm learning if this is possible) – YakovL Jun 05 '16 at 10:21