0

I'm developing an application in Angular, where in app.component.ts, when the user is without internet connection while on some page, I detect it through a Javascript event and display a component with an error message and an image SVG on HTML.

The problem is that the SVG image doesn't display after going offline. I use the IMG tag in the HTML with the URL for the image that is local.

I would like to know if any solution to be able to display this SVG image when offline. Thanks in advance.

Luidi
  • 13
  • 1
  • 4

1 Answers1

0

This link will help you to track online and offline mode, you can add your logic inside the method.

How to detect online/offline event cross-browser?

Reference URLs: Document Body: ononline and onoffline Event

JavaScript Event: Online and offline events

Pramatha
  • 29
  • 7
  • sorry for the delay in responding. I already use this Javascript event to detect when the browser is offline, so I can display the error page. The problem was that on that page there is an SVG image that is in assets, but even local the image did not display when offline, it had a 404 error in the image. I managed to solve this using PWA, so I cached the image when I start the application. – Luidi Jul 13 '21 at 16:52