Hi PP, I'm not totally sure that I follow you here, but from what you say it seems like you're trying to control Firefox from within a script executed in Rhino?
If I correctly explained what you are trying to do then read on, otherwise just stop here and perhaps you can explain what your goal is again. Rhino has nothing to do with Firefox, Rhino is a javascript engine, it will process javascript, but does not provide the DOM that firefox provides (e.g. you can't execute [window.location="yoururl.com"]) because the browser provides the DOM object on which you would execute functions and access attributes. If you were, for example, writing your own java browser, you could use Rhino to execute the javascript, but you would have to add the DOM (the methods and attributes) to the Rhino execution environment as part of your implementation. Hope that helps some, David -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] a.org] On Behalf Of [EMAIL PROTECTED] Sent: Monday, November 24, 2008 9:19 AM To: [email protected] Subject: How to communicate with Firefox in Java Hi, First, excuse my english. I need some helps about a way to communicate with firefox in my java code. I try to use the class Context http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Context.html to do it but it doesn't work. It uses Rhino technology (https:// developer.mozilla.org/en/Rhino_documentation) . I've found in internet code like that : Context cx = Context.enter(); Scriptable scope = cx.initStandardObjects(null); Object result = cx.evaluateString(scope, monScript, "<cmd>", 1, null); System.out.println("result="+cx.toString(result)); Context.exit(); (i want to do a script which will load a website on firefox but it doesn't work, so i've put on it something like "var x = 2;" in order to do not have error) I don't know if it is normal but result returns to me undefined. For me it isn't. Rhino seems to be old, so I would like to know if it always possible to communicate to firefox with this techno. I know that there are others ways to do what i want but i want to use rhino if possible (used in previous project). Thank you for your attention and your response. PP. _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
