|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Adding new JavaScript objects to ATF Browser
Hi,
I need to add some new javascript objects in a ATF's Embedded Browser instance (ATF Eclipse). Someone knows how to do this? I'm calling the browser by: (url) Thanks, Victor Emanuel dev-embedding mailing list dev-embedding (AT) lists (DOT) mozilla.org |
|
#2
|
|||
|
|||
|
Adding new JavaScript objects to ATF Browser
Jul 3, 6:16 pm, victor.perticarr (AT) gmail (DOT) com wrote:
Hi, I need to add some new javascript objects in a ATF's Embedded Browser instance (ATF Eclipse). Someone knows how to do this? I'm calling the browser by: (url) > Thanks, Victor Emanuel Maybe you could do this by creating and adding a script-node to the DM in the embedded browser. But as far as I know you can only invoke those scripts by writing your own xpcom component. Because with the MozillaBrowser execute method you can get no return value. With browser.getDocument(); you can get the nsIDMDocument from the MozillaBrowser. Then you have to find the nsIDMNode which you want to attach the script to. With node.appendChild(newnode); you can append a new child to the node you found. I have not tried this on my own so please correct me if I'm wrong. Good Luck, Christopher dev-embedding mailing list dev-embedding (AT) lists (DOT) mozilla.org |
|
#3
|
|||
|
|||
|
Adding new JavaScript objects to ATF Browser
Thanks,
I have already try this, but I found some problems. When I open the browser and set a url, I don't have the html page open immediately. So I don't have the DM document to change, only when the page have been loaded. And the problom is not only for the open html page, if the user use IFrames, my javascript objects must be accessible for all iframe. Is something like create a new default object, like document or window Do you know how to do this I'm reading everything in the internet for many day, but I can find a good documentation for mozilla thanks 4 jul, 04:30, EliteLama <elitel (AT) gmx (DOT) atwrote: Maybe you could do this by creating and adding a script-node to the DM in the embedded browser. But as far as I know you can only invoke those scripts by writing your own xpcom component. Because with the MozillaBrowser execute method you can get no return value. > With browser.getDocument(); you can get the nsIDMDocument from the MozillaBrowser. Then you have to find the nsIDMNode which you want to attach the script to. With node.appendChild(newnode); you can append a new child to the node you found. I have not tried this on my own so please correct me if I'm wrong. > Good Luck, Christopher dev-embedding mailing list dev-embedding (AT) lists (DOT) mozilla.org |
|
#4
|
|||
|
|||
|
Adding new JavaScript objects to ATF Browser
The same problem:
dev-embedding mailing list dev-embedding (AT) lists (DOT) mozilla.org |
|
#5
|
|||
|
|||
|
Adding new JavaScript objects to ATF Browser
victor.perticarr (AT) gmail (DOT) com schrieb:
The same problem: You can create your own XPCM component with javascript. If you make it a singleton implementation you can access the component with its attributes and functions from your Java application and from the javascript in the document. This solution worked well for me. For more information about writing xpcom components take a look at: dev-embedding mailing list dev-embedding (AT) lists (DOT) mozilla.org |
![]() |
| Viewing: Web Development Archives > Mailing Lists > Mozilla > Adding new JavaScript objects to ATF Browser |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|