public
Authored by avatar CY.Wang

iFactorySRPImgSrcReloader.html

iFactorySRPImgSrcReloader.html 499 bytes
<script>
  function iFactorySRPImgSrcReloader(imgElem) {
    const RELOAD_IN_SECONDS = 1;
    
    if (imgElem && imgElem.src) { setTimeout(reload, RELOAD_IN_SECONDS * 1000); }
    
    function reload() {
      const url = new URL(imgElem.src);
      url.searchParams.set('iFactorySRPImgSrcReloaderTS', new Date().getTime())
      imgElem.src = url;
    }
  }
</script>
<img src="image.jpg" onload="javascript:iFactorySRPImgSrcReloader(this);" onerror="javascript:iFactorySRPImgSrcReloader(this);">
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment