Forum Discussion

owertz's avatar
owertz
Copper Contributor
Mar 03, 2023

Caching of Images on SharePoint Online Pages

Here is the scenario: We have a SharePoint Online site which has a document library containing an image, e.g. performance.png. This image is updated each day using a Power Automate flow, but the f...
  • jaortizgolf78's avatar
    Mar 03, 2023

     

    1. Append a unique query string parameter to the image URL: You can append a unique query string parameter to the image URL each time it's updated, which will force the browser to reload the image. For example, you can add "?v=1" to the end of the image URL, and then increment the value of "v" each time the image is updated. This can be done in Power Automate by using the "Compose" action to append the query string parameter to the file URL.

    2. Change the file name of the image: If appending a query string parameter doesn't work, you can try changing the file name of the image each time it's updated. For example, you can add a timestamp or date to the file name to ensure that it's unique. This will force the browser to load the new version of the image.

    3. Use a content delivery network (CDN): You can use a CDN, such as Azure CDN or Amazon CloudFront, to serve the image file. CDNs cache content on servers located closer to the end user, which can improve performance and reduce the likelihood of browser caching issues.

    4. Disable caching for the image file: You can configure your SharePoint site to disable caching for the image file. To do this, go to the site settings, select "Site collection features", and then activate the "Output Cache" feature. This will disable caching for the entire site. Alternatively, you can use the "Cache-Control" HTTP header to control caching for individual files.

    owertz 

Resources