Share this page 

Determine the host from where the Applet is loaded (this howto is deprecated)Tag(s): DEPRECATED


import java.applet.*;
import java.awt.*;

public class FromWhere extends Applet {
  public void init() {
    Label label = new Label(getCodeBase().toString());

    add(label);
    //
    // you can check the value of getCodeBase()
    // to implements a simple copy protection
    // scheme. If it's not equals to your
    // URL then quit.
    // NOTE : This is not a very strong protection!
    //
  }
}
Try it here