///
// Called to run a JavaScript dialog. The |default_prompt_text| value will be
// specified for prompt dialogs only. Set |suppress_message| to true and
// return false to suppress the message (suppressing messages is preferable
// to immediately executing the callback as this is used to detect presumably
// malicious behavior like spamming alert messages in onbeforeunload). Set
// |suppress_message| to false and return false to use the default
// implementation (the default implementation will show one modal dialog at a
// time and suppress any additional dialog requests until the displayed dialog
// is dismissed). Return true if the application will use a custom dialog or
// if the callback has been executed immediately. Custom dialogs may be either
// modal or modeless. If a custom dialog is used the application must execute
// |callback| once the custom dialog is dismissed.
///
/*--cef(optional_param=accept_lang,optional_param=message_text,
optional_param=default_prompt_text)--*/
virtual bool OnJSDialog(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
const CefString& accept_lang,
JSDialogType dialog_type,
const CefString& message_text,
const CefString& default_prompt_text,
CefRefPtr<CefJSDialogCallback> callback,
bool& suppress_message) {
return false;
}
It would be nice if this were fixed in the Chromium engine.
I discourage usage of javascript alerts or other javascript dialogs as there are display issues on Windows XP. See this issue in the Chromium Embedded Framework that needs to be fixed:"CEF3: JavaScript dialogs are shown incorrectly in Windows XP"
What should I do if i want to use confirm box instead of alert box?
if(confirm('Do Something?')){
// do stuff
}window.confirm = function(s) { return false; }
window.prompt = function(s) { return ""; }