notification.alert Phonegap中的Html标签

时间:2013-03-26 10:08:03

标签: javascript html cordova notifications

我使用notification.alert在phonegap中发出提醒。它工作正常。我现在想要的是如何在其消息中提供HTML内容。像这样的东西

navigator.notification.alert(
     "Call the Help Desk for assistance at: <a href="#">1(800)309-0136</a>", 
      function() { }, 
     "Having trouble signing in?"
);

因此,当用户点击电话号码时,我可以拨打该号码。我试过上面的代码,它只是将标签显示为文本。请帮忙。

1 个答案:

答案 0 :(得分:0)

我认为您不能在通知警报正文中使用html。

相反,您可以使用navigator.notification.confirm拨打电话。像这样:

function onConfirm(button) {
    if(button == 'Call') {
        document.location.href = 'tel:1(800)309-0136';  //make the call
    }
}

navigator.notification.confirm(
    'Having trouble signing in?',                                            //title
    'Do you want to call the Help Desk for assistance at 1(800)309-0136?',   //message
     onConfirm,                                                              //callback
    'Call,Exit'                                                              //buttonNames
);