i visit only a few websites

so, i want to make a java program that will close my browser if i enter some other site than a selected few....
any help or a hint would be appreciated....thanks