Alert box when no internet connection - Phonegap

后端 未结 9 2808
南方客
南方客 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:47

    if you do

    if (states[Connection.NONE]){
       alert('Geen internet :(');
       };
    

    this would happen.
    do this.

    networkState = navigator.network.connection.type
    alert(states[networkState]);
    

    see if this works for u or not.

    EDIT: just compare:

    if (networkState == Connection.NONE){
      alert('no internet ');
    };
    

提交回复
热议问题