Real'sHowTo AddThis Feed Button
Custom Search

Determine the host from where the Applet is loadedTag(s): Applet


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
blog comments powered by Disqus


If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2013
[ home ]