views:

27

answers:

1

I need to be able to lock a java applet to a specific domain or range of domains. I know that it is possible to do this with flash .swf files see article. I need to be able to do this with a java applet or jar. If anyone has any information on this it would be much appreciated.

A: 

To control the web page which has the applet embedded:

getDocumentBase()

Gets the URL of the document in which this applet is embedded. For example, suppose an applet is contained within the document:

    http://java.sun.com/products/jdk/1.2/index.html

The document base is:

    http://java.sun.com/products/jdk/1.2/index.html

If you want to control where the applet binaries (.jar) are hosted, I'm not sure how to do that. The applet classloader has that information, but I don't know if there's a way to access it from an applet.

Sami Koivu
Thanks much this is very helpful.