Vortex
Vortex

Reputation: 41

Load Applet via Javascript function on the same page

I am trying to load an applet on demand via javascript.

Here is what I've tried:

function startApplet() {
    document.write('<applet code="com.pwc.envoyapp.applet.SampleApplet" height=30 width=40 archive="ucfapplet.jar"></applet>');
}

The problem is that it loads the applet in a new page. I need it to open it on the same page so that session keys generated by the applet are preserved.

Is there a way to get the applet to load on the same page?

Upvotes: 2

Views: 1899

Answers (1)

John Robert Allan
John Robert Allan

Reputation: 225

have you tried something like:

document.getElementById("appletContainer").innerHTML = "<applet ... />";

of course you'd need the element to exist so somewhere in your DOM you'd have:

<div id="appletContainer"></div>

as an empty element waiting to be populated.

Upvotes: 1

Related Questions