Custom JavaScript alerts in iOS using PhoneGap HTML

后端 未结 3 481
渐次进展
渐次进展 2020-12-31 10:29

My app has a couple of JS alerts and it seems to always display the page name like.

index.html

Is there a way to change the index.html to my App\'s name or

3条回答
  •  清酒与你
    2020-12-31 11:28

    Like Simon said check out the notifications it's part of the phonegap API.

    You call it like this -

    Notification with options:

    navigator.notification.confirm(
       "This is my Alert text!",
        callBackFunction, // Specify a function to be called 
        'Alert Title',
        ["Ok", "Awesome"]
    );
    
    function callBackFunction(b){
      if(b == 1){
        console.log("user said ok");
      }
      else {
        console.log("user said Awesome");
      }
    }
    

    A simple notification -

    navigator.notification.alert(
        "This is my Alert text!",
        callBackFunctionB, // Specify a function to be called 
        'Alert Title',
        "OK"
    );
    function callBackFunctionB(){
        console.log('ok');
    }
    

    Hope that helps!

提交回复
热议问题