0

I am creating phonegap project using cordova 3.4.0. I check the network connect is enable on while start the application. I installed cordova network-information plugin. The following codes are i am using.

if(navigator.network.connection.type == Connection.NONE){
    alert("nocon");
}else{
    alert("yescon");
}

It's working fine. But i want to display conform box for no network connection. One button for settings and another one for cancel. If i click setting button, it will go to wifi-setting option. And if i click cancel button, app will exit. How can i do this. Please guide me.

4

1 回答 1

0

点击调用下面的函数,

onclick="showConfirm();

并在js文件上添加如下,

function showConfirm() {
        navigator.notification.confirm(
            'Your message here!',   // message
            onConfirm,              // callback to invoke with index of button pressed
            'Your title',           // title
            'Options,Exit'          // buttonLabels
        );
    }

function onConfirm(buttonIndex) {
        //Do the magic here.
    }

如果您对答案感到满意,请点击接受。

于 2014-05-13T11:41:47.177 回答