Reload images in PhotoBrowser after internet connection lost

Hi! How can I automatically reload PhotoBrowser’s images after device loses and restores internet connection?

I’ve tried this:

window.addEventListener("online", function() {

But with no luck.

Window’s “online” event is fired, but how can I reload missed photoBrowser’s images?

Now my app’s users have to close and open the PhotoBrowser after reconnection themselves, which is inconvenient.

P.S. I use lazy loading.

I guess you need to force browser to reload image, something like:

$('.photo-browser img').each((imgEl) => {
  const src = imgEl.src;
  if (!src) return;
  // unset src
  imgEl.src = undefined;
  // set it back
  imgEl.src = src;
1 Like

Thank you for reply!
I tried this and it works fine. But the thing is this approach updates only 3 images: current, previous and next because there aren’t other images in DOM at the moment.
I wonder if there is a possibility to update all PhotoBrowser’s images?

I think you can add slideChange event listener to your photo browser and add that code there, so it will reset images on every slide change

1 Like

Vladimir, thank you for help! Now it works perfect :slight_smile: