The solution you have come across seems like the only one so far in case you want to show some images. Otherwise you can always display the alt
attribute value of the img
tag and warn the users that they are offline.
As for the caching solution you can try this library
which provides a lot of useful APIs.
I hope it helps.