This is my prompt alert box function in XUL: function promptBoxes()
{
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var check = {value: false}; // default the checkbox to false
var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_Ok+
prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_IS_STRING;
var button = prompts.confirmEx(null, "Title of this Dialog", "What do you want to do?",
flags, "", "Cancel", "", null, check);
// 0, 1, or 2.
}
I have taken the above function from this website: https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIPromptService#alertCheck_example
How could I close this box automatically within 10seconds(with display message: this prompt box will close in 1O seconds and display the timer in the box itself)?
How can position this box to shown at the corner of the system?
I don't find any timer details in Mozilla prompt service
I don't think this is possible with the build in prompt but you can easily do so with a custom prompt window.
1) Create a XUL dialog alert_prompt.xul as follows:
2) Create a Javascript file for this XUL window alert_prompt.js
3) Instead of showing the alert prompt as earlier use this statement:
If you want to return a value from the alert box such as which button was pressed you can do so in the same way as discussed HERE
I am not sure about the positioning of a modal window so you may want to ask that in a separate question.