Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the default heading of 'alert'

I am trying to use the alert method, so the native iOS like alertView will popout. Everything works fine, and the alert gets displayed. But the Heading of the Alert is always index.html.

How can i edit the heading of the alert method

like image 205
user1315906 Avatar asked May 07 '12 17:05

user1315906


2 Answers

You'll want to use navigator.notification.alert() from the PhoneGap API instead. It will allow you to set a title on your alert box.

like image 197
Simon MacDonald Avatar answered Nov 14 '22 05:11

Simon MacDonald


If you don't want to refactor your code, you can override the alert() method with a notification :

window.alert = function (txt) {
   navigator.notification.alert(txt, null, "Alert", "Close");
}

You can custumize the window title : "Alert, and the close button : "Close"

like image 33
Intuitisoft Avatar answered Nov 14 '22 03:11

Intuitisoft