Application design to notice code changes

Just starting out? Need help? Post your questions and find answers here.
bbanelli
Posts: 107
Joined: Mon Jul 13, 2015 7:40 am

Application design to notice code changes

Post by bbanelli »

Greetings to all,

is there any "standardized" approach to notify user that local (cached) copy of his SpiderBasic complied software differs from the actual one on web server? Without it, I'm having difficulties communicating with clients by having to repeat constantly - "make sure you Ctrl+F5 to get the newest version of your software".
"If you lie to the compiler, it will get its revenge."
Henry Spencer
http://www.pci-z.com/
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

Re: Application design to notice code changes

Post by Fred »

If your webserver is well configured, it should be seemless, as the webserver compares dates before sending new files. You can may be do a recursive 'touch' on all your files when you updload a new version, and ensures your webserver date is right.
bbanelli
Posts: 107
Joined: Mon Jul 13, 2015 7:40 am

Re: Application design to notice code changes

Post by bbanelli »

Hi Fred,

I haven't noticed such behavior. :( Newer files on server have changed (younger) timestamp that "old" application but when clicking a link or merely pressing enter in address bar, "old" code remains. It is only Ctrl + F5 that forces reload and new files. Same in Chrome, IE 11 and Edge.

Server is LiteSpeed but IIRC same thing happened in old SB versions with Apache. Server time is properly set.

You can see a short video here: http://youtu.be/dlgZMw7MUO0?hd=1

I have changed title of the window, tried several times "reloading" a link by clicking on the address bar + enter, but only after Ctrl + F5 it actually changed. Times on server, as I've said and you can see it on the video, are just fine.

Thank you in advance for any insight,

Bruno
"If you lie to the compiler, it will get its revenge."
Henry Spencer
http://www.pci-z.com/
cederavic
Posts: 30
Joined: Tue Feb 25, 2014 6:49 am

Re: Application design to notice code changes

Post by cederavic »

Hello,
If your server can dynamically serve the html page, you can put a timestamp param in the src of the script
eg :

Code: Select all

<script type="text/javascript" src="spiderbasic.js?timestamp={{sb_timestamp}}"></script>

Where {{sb_timestamp}} is something like 201611151047236 or what you want. The browser cache the file based on the url so if the url change it while update it.
This is what i use got always get and up to date client side version. It works on css too.
Post Reply