Hi Jacek, I think the following does what you want (written in terms of java/javaxpcom):
String url = "javascript:" + script + ";void(0);"; nsIWebNavigation navigation = (nsIWebNavigation)webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATI ON_IID); navigation.loadURI(url, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); Grant "Jacek Caban" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I need to execute JavaScript code in my app that hosts Gecko. This code > needs to be executed in the browser's context. Looking at the code, I > could use it by using nsIScriptContext interface, but it doesn't look > like something acceptable for me. It's a very internal interface itself, > and it's even worse with ways to get it. I've found that I could get it > from nsIGlobalObject gotten from QI nsIDOMWindow (how to get it? content > window doesn't seem to work here) or nsIDocument. Whole this needs > definitely too much internal stuff to be acceptable for me (these > interface are not even declared in IDLs). > > So my question is: is there any good way to do it? > > I already started writing a patch to add such API to Gecko. My idea is > adding a wrapper interface exported by the document object that would > hide nsIScriptContext internals. Do you thing it's a good way to go? Or > should it be implemented in an other place? > > Thanks, > Jacek Caban > _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
