My newest project is a Java Applet game (still hush hush on the details tho…) and I thought I’d share a nice little tip for securing a java applet so that it can only be run from within your webpage and not from anybody elses.
This is particularly useful if you don’t want others to profit by embedding your game in their site.
The code is simple
// check host
String hostname = getDocumentBase().getHost();
if (hostname.equals("www.peachysoft.com"))
{
// All is well run the applet
}
else
{
// dont run the applet
}

1 response so far ↓
1 U_Z // Nov 6, 2007 at 11:56 pm
Thanks for the tip!
Leave a Comment