futureag / mvp

Copy of webbhm/OpenAg-MVP-II
MIT License
20 stars 15 forks source link

Avoid caching in browser #23

Closed johnpmitsch closed 6 years ago

johnpmitsch commented 6 years ago

Currently the UI is cached in the browser. As a user, I found this confusing when I first tried to access the UI, and I wasn't crazy about the solution given to turn off caching in the browser.

This commit adds a random query string that is added to any of the image/svg files when a tab is opened. This "tricks" the browser into making a new call for the image, but doesn't affect the actual image retrieval. The call now looks like:

http://localhost:8000/temp_chart.svg?3856680481

where 3856680481 is a randomly generated number that will differ on each call.

This way the image always stays updated on a browser refresh and simplifies the process of installing the software by no longer needing to turn browser caching off.