AJAX Gotcha Browser caching

[problem]

Spent many hours debug my code on elizaclaire.darlingranges.com.

I kept wondering why, whenever I updated the code – it did not get reflect through.

[/problem]

[solution]

Eventually but printing the date within the sub request, I found the browser was caching the sub request!

The fix was very easy, to force a header under apache – turning off caching.

[/solution]

[example]

Header set cache-control "no-cache"
Header set Pragma "no-cache"
Header set Expires "-1"

[/example]

[reference]

[tags][/tags]

[/reference]

If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

Your email address will not be published. Required fields are marked *