4
I wonder if somehow I could change the title of a window confirm()
, because I’m developing an app using phonegap and when called this window it presents me the title with the name of my html file, I can modify this? if yes as?
4
I wonder if somehow I could change the title of a window confirm()
, because I’m developing an app using phonegap and when called this window it presents me the title with the name of my html file, I can modify this? if yes as?
4
You are probably using the plugin org.apache.cordova.dialogs
.
Users/ft/projectname/platforms/ios/www/plugins/org.apache.cordova.dialogs/www/notification.js
Opens the file Notification.js
and find the section below.
/**
* Open a native confirm dialog, with a customizable title and button text.
* The result that the user selects is returned to the result callback.
*
* @param {String} message Message to print in the body of the alert
* @param {Function} resultCallback The callback that is called when user clicks on a button.
* @param {String} title Title of the alert dialog (default: Confirm)
* @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel'])
*/
confirm: function(message, resultCallback, title, buttonLabels) {
var _title = (title || "Confirm");
var _buttonLabels = (buttonLabels || ["OK", "Cancel"]);
// Strings are deprecated!
if (typeof _buttonLabels === 'string') {
console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array).");
}
And just remove "Confirm" and leave it blank:
var _title = (title || "Confirm"); --> var _title = (title || "");
And now let’s adjust the "Alert" part, find a similar code and do:
var _title = (title || "Alert"); --> var _title = (title || "");
I tested on Android and worked beautiful but not tested with iOS.
See it and tell me if it helped.
3
It is not possible, the alternative would be to use some kind of modal.
This limitation is for security reasons, a malicious person could change the URL shown in the confirmation window for example.
3
You should pass the title as parameter, for example:
notification.confirm('message',onConfirm,'title','Restart,Exit');
that is, the order of the parameters is: Message, function to be executed in the return, title and the "Labels" to be used in the buttons.
2
You could use the notification.confirm()
phonegap:
navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])
More details on:
http://docs.phonegap.com/en/2.6.0/cordova_notification_notification.md.html
1
a very simple to use modal is the bootbox
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Minha Página</title>
<!-- CSS dependencies -->
<link rel="stylesheet" type="text/css" href="./bootstrap.min.css">
</head>
<body>
<p>Conteúdo. <a class="alerta" href=#>Alerta!</a></p>
<!-- dependências JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="./bootstrap.min.js"></script>
<!-- código bootbox -->
<script src="./bootbox.min.js"></script>
<script>
$(document).on("click", ".alerta", function(e) {
bootbox.confirm("Olá Mundo!", function() {
console.log("Alerta Callback");
});
});
</script>
</body>
</html>
Official link: http://bootboxjs.com/
Browser other questions tagged jquery html apache-cordova
You are not signed in. Login or sign up in order to post.
a modal with a button that confirmed my authentication right?
– Marcos Henrique
Yes! It’s quite simple to implement this.
– Laerte