Someone pointed out to me that javascript has the requisite handlers for these functions. However my program is written in Java. Is it possible to execute javascript in a java program as well as receive information from the javascript? Can I run some javascript code in a java program somehow and also get information from the javascript thread, or class or whatever I would have to use, such as if the browser is loading in the java program? So that it could query the Javascript thread/process/class/object and then use the information received from the Javascript, such as wait until the javascript says the browser is no longer loading?