Skip to content Skip to sidebar Skip to footer

Netscape.javascript.jsexception: Syntaxerror: Unexpected Keyword 'this'. Expected ')' To End A Argument List

I'm trying to insert a String of text into a

element inside a HTML document inside a WebView. .java webEngine = webView.getEngine(); Stri

Solution 1:

The string you pass to the Javascript method needs to have quotes:

webEngine.executeScript("testCheckMate(\""+ headerText +"\");");

Solution 2:

You pass a string which already contains the " character. So from Java side you must quote this with \" . However in JavaScript this String is again parsed and the \" will be the end of string. This is why the end argument list error is thrown. When passing strings, which are used to invoke functions, you should use on Java side:

ret = ret.replaceAll("\"","\\\\\""); 

This solved my problem.

Post a Comment for "Netscape.javascript.jsexception: Syntaxerror: Unexpected Keyword 'this'. Expected ')' To End A Argument List"