JS page load indicator for iOS

175 Views Asked by At

I'm trying to implement an animated gif for a page loading indicator for my PWA/mobile site. I have this working fine for Android using:

      // None iOS devices.
      $(function () {
        $(window).on('beforeunload', function () {
        $('#indicator').show();
        });
      });

This doesn't work with iOS and I understand the "pagehide" event is the one to use, but it doesn't work either:

      window.addEventListener('pagehide', event => {
        $('#indicator').show();
      }, false);

Can anyone tell me what I'm missing or have a simple clean solution for this with iOS devices?

0

There are 0 best solutions below