Re: How to call a website in a frame?

[email protected] Thu, 26 Apr 2007 12:14:56 -0400
Newsgroups gmane.comp.mozilla.jrex
Message-ID <[email protected]>
Hi Billy,

I've responded below, in-line.


Billy wrote:
 > If I just find a link in the DOM of the frame - how to trigger it
 > inside of it? I just know the possibility of the loadURI-call of the
 > webnavigator that does the call at the main browser.

If links are okay, then once you have a reference to the link element 
(the "A" tag), you can follow the instructions I provided in an ealier 
message to trigger a click:

    1. Given a node, get the associated DocumentEvent
    2. Using the DocumentEvent object, create a new event whose eventType
       is "MouseEvents"
    3. Initialize the new event specifying the sub-type as "click" and
       the target as the node that should receive the click (see
       http://developer.mozilla.org/en/docs/DOM:event.initMouseEvent for
       more details)
    4. Dispatch this event using the event target associated with the DOM
       node to be clicked.

Here's the code :

      EventTarget relatedEventTarget = ((JRexNodeImpl)elm)
                                                      .getEventTarget();
      DocumentEvent event = ((JRexHTMLDocumentImpl)
                             elm.getOwnerDocument())
                            .getDocumentEvent();
      MouseEvent clickEvent = (MouseEvent)
                              event.createEvent("MouseEvents");
      // initMouseEvent described here:
      //    http://developer.mozilla.org/en/docs/DOM:event.initMouseEvent
      clickEvent.initMouseEvent("click", true, true, null, 1, 1, 2, 1, 2,
                                false, false, false, false, (short) 0,
                                relatedEventTarget);
      relatedEventTarget.dispatchEvent(clickEvent);




 > Forthermore I dont know much about JSObject either...

I can't be of much help with the JS stuff, since I haven't used it either.



Hope that helps.

--Chris