Is using a cookie a good way to check if an app has been updated and needs to be refreshed from the server?

3643
9
03-10-2016 07:15 PM
AndrewTerwiel
Occasional Contributor II

When an app has been updated and re-published, a browser will load the files from the cache and not the server. This means each user needs to manually clear the cache and refresh. I thought about having a "refresh" widget that creates a cookie with a version number as the name, and then on subsequent page loads, reading the name and comparing it to a variable to determine if the app has been updated. If the version number is different then execute this:

document.location.reload(true);

Does anyone have a better idea?

9 Replies
RobertScheitlin__GISP
MVP Emeritus

Andrew,

  I think that is a good idea.

LarryStout1
New Contributor II

Wish I had thought of it.  Great idea.

AlanMilroy
New Contributor

Would you mind writing a step by guide for dummies? I am hitting the same problem

JamesCrandall
MVP Frequent Contributor

I second the request!  Even loosely thought out, unorganized and untested suggestions would be welcomed!

0 Kudos
AndrewTerwiel
Occasional Contributor II
AndrewHayden1
Occasional Contributor

Any insight as to what I need to do to get it to work in WAB 2.9?  I've not had any success either directly or creating an app in an older version and upgrading.  Registry is undefined for registry.byId('versionTextBox').  Not sure how to resolve that.

0 Kudos
AndrewTerwiel
Occasional Contributor II

Hi Andrew,

Do you have the tag below in your setting.html?

<input data-dojo-attach-point="textNode" data-dojo-type="dijit/form/TextBox" id="versionTextBox" />
0 Kudos
AndrewHayden1
Occasional Contributor

Yes, I haven't really modified anything other than the app version in the config.  At setting.js startup I get "dojo/parser::parse() error Error: Tried to register widget with id==jimu_dijit_LoadingIndicator_0 but that id is already registered" at parser.parse() and this._getVersionTextBox() returns undefined which results in "init.js:114 TypeError: Cannot read property 'set' of undefined" at this._versionTextBox.set.

0 Kudos
by Anonymous User
Not applicable

I also can't get this to work.  I tried it in WAB 2.12 and it would not let me click the OK button or enter a version number. So it couldn't be added. Just keeps displaying the animated progress bar gif.

However, I dropped it in WAB 2.4 and it worked fine. So something changed I suppose.

0 Kudos