javascript alert title

1,676 views
Skip to first unread message

sonali patel

unread,
Feb 1, 2014, 7:36:06 AM2/1/14
to phpde...@googlegroups.com
How to change javascript alert title from 'Javascript Alert - 127.0.0.1:54007' to any custom title? please answer me fast

Czarek Tomczak

unread,
Feb 1, 2014, 7:40:41 AM2/1/14
to phpde...@googlegroups.com
Hi Sonali,

You could overwrite the default implementation of the javascript alert function, see:

You could create a custom UI alert dialog using jQuery, see for example:

Best regards,
Czarek

Czarek Tomczak

unread,
Feb 1, 2014, 7:43:54 AM2/1/14
to phpde...@googlegroups.com
The other solution would be to fix it in the Chromium engine. We would need to implement CefJSDialogHandler::OnJSDialog callback:

///
  // 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;
  }

Please create an issue in the tracker if you need that.

-Czarek

sonali patel

unread,
Feb 1, 2014, 7:49:01 AM2/1/14
to phpde...@googlegroups.com
HI Czarek Tomczak,

     Thank you for your help.It works like what i want.


Best regards,
Sonali

Terry

unread,
Feb 1, 2014, 8:01:45 AM2/1/14
to phpde...@googlegroups.com
It would be nice if this were fixed in the Chromium engine.

Thank you Czarek for the links to the other two solutions,.

Terry

Czarek Tomczak

unread,
Feb 1, 2014, 8:23:11 AM2/1/14
to phpde...@googlegroups.com
Hi Terry,


On Saturday, February 1, 2014 2:01:45 PM UTC+1, Terry wrote:
It would be nice if this were fixed in the Chromium engine.

Please create an issue then.

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"

Best regards,
Czarek

Czarek Tomczak

unread,
Feb 1, 2014, 8:24:49 AM2/1/14
to phpde...@googlegroups.com
On Saturday, February 1, 2014 2:23:11 PM UTC+1, Czarek Tomczak wrote:
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"

I see now that this issue is tagged as "NextRelease", so it is going to be fixed in the next CEF release.

-Czarek

Terry

unread,
Feb 1, 2014, 8:46:06 AM2/1/14
to phpde...@googlegroups.com
Sorry, I assumed an issue was already created by Sonali.

sonali patel

unread,
Feb 3, 2014, 12:13:58 AM2/3/14
to phpde...@googlegroups.com
Hi Czarek,

   What should I do if i want to use confirm box instead of alert box?

Regards,
Sonali

Czarek Tomczak

unread,
Feb 3, 2014, 4:52:58 AM2/3/14
to phpde...@googlegroups.com
On Monday, February 3, 2014 6:13:58 AM UTC+1, sonali patel wrote:
What should I do if i want to use confirm box instead of alert box?


The confirm() and prompt() cannot be easily replaced, because of the synchronous way they work:

if(confirm('Do Something?')){
   // do stuff
}
These functions block UI thread until user clicks OK/Cancel in the dialog. Such behavior cannot be replaced with javascript.

For now you could disable these functions for example:

window.confirm = function(s) { return false; }
window.prompt = function(s) { return ""; }

Star Issue 73 and you will be notified when titles for javascript dialogs get fixed.

-Czarek



sonali patel

unread,
Feb 4, 2014, 1:15:41 AM2/4/14
to phpde...@googlegroups.com
HI Czarek,
     I have already tried with jquery confirm dialog box, it works but
not really working greak what i want bcoz when i press ok and when
form submit , again call form validation but i want to prevent
validation function call when i press ok button and form submit
without check validation but it is not working .

Regards,
Sonali

kcee...@gmail.com

unread,
Nov 23, 2017, 8:54:56 AM11/23/17
to PHP Desktop
bro in some websites like (example) www.w3schools.com. thier websites alert boxes title are changed like www.w3schools.com says.how they changed the alert box title.
Reply all
Reply to author
Forward
0 new messages