B4J Code Snippet [ABMaterial] Avoid browser image cache


Active Member
Licensed User
Straight to the point:

Just add a random number after image path then browser will never use the cache for that image. Actually is a "new" image every time for the browser.
page.CellR(1,1).AddComponent(ABMShared.BuildImage(page, "logoempresa","../uploads/logo.png" & "?" & DateTime.Now,1,"",187,106,False))
I've used DateTime.Now to generate the random number.

A page, from my ABMaterial application, allows the user upload an image that will be used as company logo.
I've noticed that if image uploaded with same name (old image) browser will cache that file and even is a different image browser still use the cached image.
I've found the workaround over here.
As I'm not a html expert I took a while to understand what's going on and find a solution.