6

I have a Java Applet in a HTML page. I need to have the applet call a certain Javascript function to notify the HTML page of certain events.

The way I call the JavaScript function currently is:

getAppletContext().showDocument(new URL("javascript:window.notifyEvent("+msisdn+")"));

I define the actual function within the HTML code but when the applet actually calls it I get the Uncaught ReferenceError: notifyEvent is not defined error.

Where do I need to define the javascript function for the applet to be able to call it?

Thanks!

2 Answers 2

3

To do this, you must use JSObject. It's been around for a long time, although I hear there can be differences between browsers still. So if you need to support many browsers I'd suggest checking across your supported set once you see it work in one.

Bridge between the Java applet and the text input controls on the web page

Sign up to request clarification or add additional context in comments.

Comments

1

You can give this a try http://docs.oracle.com/javase/tutorial/deployment/applet/invokingJavaScriptFromApplet.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.