Best Practice for forcing a JavaScript Error?

I want to test my Session.JavaScriptError code. What is the recommended way to create a JavaScript error for testing that Event Handler?

ExecuteJavaScript with some invalid call.

E.g. „test();“

I find that I don’t get a text file with the JavaScriptError when I hit a button that does this:


The Web app folder has been tested to be writable. I have tried in both these scenarios:

  1. Don’t create a Session.JavaScriptError Event Hander.
  2. Create a Session.JavaScriptError Event Handler with only one line: Return False

Technically xxx isn’t an error. Try that same call with () at the end as if you are calling a method.

Thanks, Greg. Tried this for the button action:


With Session.JavaScriptError having only one line of code:

Return False

No text file is written. I even tried having that handler write the error to database after confirming a good database connection, and then returning True. No database entry.

MIght v2018r4 not be handling Session.JavaScriptError at all for some reason?

Found the problem. If the infamous Grammarly browser plugin in active, then the JavaScriptError User Input dialog Send button will not work. If that plugin is disabled, the Send button will work and the appropriate errors.log file is written. The Grammarly plugin is known to interfere with Xojo WebTextArea controls.

So I have to make sure Session.JavaScriptError calls my own dialog, and that dialog uses a WebTextArea that disables the Grammarly plugin. To disable the Grammarly plugin for a particular WebTextArea, I have subclassed that control and have its Shown event use the following JavaScript:

ExecuteJavaScript(_ "document.getElementById("""+Me.ControlID+"_inner"").setAttribute(""data-gramm"", ""false"");"_ )

To read up on this problem do a Search on ‘Grammarly’ on this forum. There are many entries. Here’s a good one:

Oh well. Back to the drawing board. I can’t get my own dialog to display on a JavaScriptError. The built-in dialog displays and I don’t know how to disable the Grammarly plugin on that because (I think) I have no control over it via code.

I started a new thread on how to deal with the Grammarly browser plugin preventing the JavaScriptError Dialog from working properly: