New to Javascript: How can I automate interaction between framecontents from different domains?

Discussion in 'Javascript' started by Ted Byers, Aug 12, 2009.

  1. Ted Byers

    Ted Byers Guest

    If I understand the FAQ correctly, I can't access the contents of one
    frame from another frame if they're from different frames.

    I believe I can access the contents of a field using what looks like
    "document.dialer_form.comments.value"

    The dialer is from one domain, and I have created a cgi script that
    creates the contents of a second frame. Actually, my prototype web
    page has two frames, one of which has a search engine that invokes my
    cgi script to produce the contents of a second frame. But right now,
    my colleagues that have to use these pages have to have one browser
    connected to the dialer's web page, and a second connected to my page,
    and they have to copy the contents of one field in the dialer's page
    and paste it into a field in my search engine, and pres submit to get
    the rest of the data they need. I want to make this faster,
    automatic, to reduse the chances of human error. So I thought I would
    try to load the dialer's page into a new, third, frame in my page, and
    create an event handler so that when the contents of that one field in
    the dialer's web page changes, the value is automatically submitted to
    my search engine.

    If I can't access the contents of a control in the contents of one
    frame from another from a different domain, can I do so from the
    frameset page that places that content into a frame it contains, to
    add the appropriate parameter to the SRC attribute of the other
    frame? And if the correct name of the control is what I gave above,
    how would that name change if I try to access it from a frameset or
    frame that needs it?

    If the info I need is in one or more FAQ's, please provide the URL
    that will lead me to it. I have been searching through the FAQ at
    http://jibbering.com/faq, but I may have missed queries that would be
    relevant.

    NB: while I have written very little Javascript, I have extensive
    experience using Java, C++, Perl, JSP/JSF, ... I am just faced with
    an issue now that isn't so easily addressed using the languages I
    know.

    Thanks in advance for your aide.

    Ted
     
    Ted Byers, Aug 12, 2009
    #1
    1. Advertising

  2. Ted Byers wrote:
    > If I understand the FAQ correctly, I can't access the contents of one
    > frame from another frame if they're from different frames.


    If you mean "second-level domain" instead of "frames", you understood correctly.

    > I believe I can access the contents of a field using what looks like
    > "document.dialer_form.comments.value"


    Whereas it should be

    document.forms["dialer_form"].elements["comments"].value

    provided that the form with name or ID "dialer_form" is in the same
    document, that is, it is not located within an (i)frame in the document.
    If it were, you would need something along

    window.frames[...].document.forms[...].elements[...].value

    > The dialer is from one domain, and I have created a cgi script that
    > creates the contents of a second frame.
    >
    > Actually, my prototype web page has two frames, one of which has a search
    > engine that invokes my cgi script to produce the contents of a second
    > frame.


    You appear to be a bit confused about when to use "domain" and when "frame".
    Assuming you mean "domain in an (i)frame" instead of "frame" here:

    > [...] So I thought I would try to load the dialer's page into a new,
    > third, frame in my page, and create an event handler so that when the
    > contents of that one field in the dialer's web page changes, the value is
    > automatically submitted to my search engine.


    ISTM you do not need a third frame as you can add event listeners to the
    form in the first frame that shows the dialer. But I could be wrong as I
    find your description rather long-winded and (thus) confusing (especially
    this summer).

    > If I can't access the contents of a control in the contents of one frame
    > from another from a different domain, can I do so from the frameset page
    > that places that content into a frame it contains, to add the appropriate
    > parameter to the SRC attribute of the other frame?


    Mu.

    (Use transparent proxying to access the other domain's resources.
    Note that copyright applies, and take care of XSS.)

    > And if the correct name of the control is what I gave above, how would
    > that name change if I try to access it from a frameset or frame that
    > needs it?


    Mu, again.

    (The name of the control would not change.) The _referencing_ depends on
    where the control is located in relation to the frame. Look into the
    `parent', `top', and `frames' properties of Window objects.

    > If the info I need is in one or more FAQ's, please provide the URL that
    > will lead me to it. I have been searching through the FAQ at
    > http://jibbering.com/faq, but I may have missed queries that would be
    > relevant.


    Possible. What search terms have you used?

    The most pertinent document to read in your case, besides section 1.3 of
    the FAQ and documents linked there, would probably be
    <http://www.catb.org/~esr/faqs/smart-questions.html> (linked in the FAQ
    Notes), as the lack of other replies to your posting, but the existence of
    replies to newer postings would indicate that other people are having
    similar difficulties understanding your posting and answering your questions.

    > NB: while I have written very little Javascript, I have extensive
    > experience using Java, C++, Perl, JSP/JSF, ... I am just faced with an
    > issue now that isn't so easily addressed using the languages I know.


    It is not a matter of the programming language but about knowing your
    tools (and knowing what you are doing with them). You are dealing with
    language-independent DOM APIs in this case.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Aug 13, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john
    Replies:
    2
    Views:
    477
    Chris Jackson
    Dec 11, 2003
  2. =?iso-8859-1?q?Nils Hedstr=f6m

    Sharing login between different domains

    =?iso-8859-1?q?Nils Hedstr=f6m, Jan 24, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    343
    Steven Cheng[MSFT]
    Jan 25, 2005
  3. WeAreGoing!
    Replies:
    1
    Views:
    156
    Lasse Reichstein Nielsen
    Dec 1, 2003
  4. walala

    how to automate webpage interaction?

    walala, Nov 2, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    231
    Glenn Jackman
    Nov 2, 2003
  5. Jimmy
    Replies:
    3
    Views:
    2,415
    shimmyshack
    Nov 20, 2006
Loading...

Share This Page