Search code examples
javajavascriptappletundefinedjapplet

Check javascript function is defined from java applet


I am developing a Java applet where I call a javascript function:

boolean isAllowed = (boolean) win.eval("isPointMarkCreationAllowed()");

and I would like to check if that function exists, like we do in javascript:

if (isPointMarkCreationAllowed == 'function')

is there anyway to do that in Java?


Solution

  • Without actually having tried it, wouldn't

    win.eval("typeof isPointMarkCreationAllowed == 'function'");

    do exactly what you want and return a Boolean (true or false)?