rquispeg / phpdesktop

Automatically exported from code.google.com/p/phpdesktop
0 stars 0 forks source link

Set javascript dialog window title to something readable #73

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
How to change javascript alert title from 'Javascript Alert - 127.0.0.1:54007' 
to any custom title?

Original issue reported on code.google.com by ccn...@gmail.com on 1 Feb 2014 at 1:48

GoogleCodeExporter commented 9 years ago
When reporting issue please post the details from the related topic.

----------------------------------------------------------------------------

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

Another fix to javascript dialogs on XP is required as well:

  "CEF3: JavaScript dialogs are shown incorrectly in Windows XP"
  https://code.google.com/p/chromiumembedded/issues/detail?id=760 

Ffor now a solution to this problem is to overwrite the default javascript 
dialog with our custom UI dialog, see this jQuery example:

  http://andrewensley.com/2012/07/override-alert-with-jquery-ui-dialog/

Original comment by czarek.t...@gmail.com on 1 Feb 2014 at 2:01

GoogleCodeExporter commented 9 years ago
This concerns the following javascript dialog windows: alert(), confirm(), 
prompt().

Original comment by czarek.t...@gmail.com on 3 Feb 2014 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 13 Oct 2014 at 6:55

GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 21 Oct 2014 at 10:37

GoogleCodeExporter commented 9 years ago
Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/phpdesktop/issues/73

Original comment by czarek.t...@gmail.com on 24 Aug 2015 at 3:25