I need to add the “date/time modified” to the end of an href link to force a re-cache of an image

I have the following link to an image:

a href=”/Portals/0/Images/Current_Cert.png”>ISO Certification</a

This returns the current ISO certification for my company and displays it when the link is clicked.

However, if the certification expires, or is not renewed, companies don’t want to do business with us (or worse – may pull business from us), so the cert needs to display the current version every time the link is clicked.

To keep from needing to update ALL 108 HYPERLINKS across the website, I have all of them pointing to a single file, namely “Current_Cert.png”. The reference above is in place of every one of the 108 links.

Previously, there was a “?v=6423876478356837” or something or other attached to every one of those links so that the browser forces a recache and grabs a new image when I update the file, but that required me to manually add the “current” version of that “?v=…” number to the end of each of the 108 links to avoid the user’s browser displaying an expired cert from their cache.

THE QUESTION:

Is there an appended function I can use to put the “date/time modified” value on the end of the href link above that will return a filename such as “Current_Cert.png?v=234729876989726” that is the following:

  1. the same code for every link so that I never have to update it, I only have to update the image it references, and

  2. only recaches and forces the browser to grab a new file if it has been updated, i.e.- the date/time modified has changed the ending of the filename?

for example, maybe something like:

<a href=”/Portals/0/Images/Current_Cert.png” + “?v=” + Current_Cert.png.DateModified >ISO Certification

I have tried various versions I have found online, but none have been a robust enough solution to work every time and for every browser.

Also, because this is in a third-party-managed web shell, I have limited capability to alter the CSS or use JS to accomplish this.

I was hoping there was a way for the HTML code to reference the date/time modified as a parameter that can be appended to the filename.

That way, the most recent version of the file occurs as the filename in the link no matter where in the website it is clicked, and ONLY if it has been updated, will no longer match the user’s browser cache.

I do not want someone regularly visiting the site to cache a new file every time they click (thereby clogging their browser cache with hundreds of duplicate files), only when it is updated, so that every page load will append the same suffix until the date/time modified of the file changes, and the current cert will not recache and grab a new version until then.

New contributor

Cranky McPants is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật