Is there any way to programmatically dismiss navigator.notification.alert()? I alert when there’s a location services error, but if it clears, I’d prefer to dismiss it rather than require the user to do it manually.
Any ideas or solutions?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t programmatically dismiss an
alert()dialog, no.What you could do, however, is instead of using
alert()implement your own custom overlay that looks/acts similarly to an alert, and then you can easily dismiss that whenever you want. Some additional discussion is here:Javascript close alert box
Edit
I did a bit more investigation into this and I no longer believe that the Phonegap
alert()dialog is actually the same as the native JavaScript dialog. They are using some clever tricks to call back into native code (on both Android and iOS) to show the alert.As such, it may be possible to dismiss the dialog programmatically, but almost certainly not from directly within your JavaScript code. You would need to use some similar trickery to call back from your JavaScript into native code, and then locate and dismiss the Phonegap alert view. The first part may be fairly difficult. The second part is trivial:
Hide UIAlertView programmatically?