Alert box when no internet connection - Phonegap

后端 未结 9 2807
南方客
南方客 2021-02-20 06:55

I\'m trying to get a pop-up to, well, pop up when there is no internet connection on the device.

I got the following example working, but now I want the alert only to sh

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-20 07:40

    That's because you are testing the truthiness of a constant. That type of test will always return true. What you want to use is:

    if (navigator.network.connection.type == Connection.NONE]{
      alert('Geen internet :(');
    };
    

提交回复
热议问题