That's probably the easiest solution.  An alternative is passing the data in
the URL of the IFRAME, which you can still read across domains.

~Arne

On Thu, Apr 24, 2008 at 11:46 PM, jfahrenkrug <[EMAIL PROTECTED]> wrote:

>
> Arne,
>
> I need the response the server gives me in my JavaScript code (a
> special error code or a success message with a link).
> So the way I see it I need to save that response on my server and
> request it with makeRequest after the file upload is finished because
> 1) I can't use xmlhttprequest
> 2) I can't use makerequest for big file uploads
> 3) I can't access the iframe body (if I set that as the form target)
> because of the cross domain restriction.
>
> Is that about right?
>
> - Johannes
>
> On Apr 24, 8:47 pm, "Arne Roomann-Kurrik" <[EMAIL PROTECTED]>
> wrote:
> > Hi Johannes,
> >
> >    Yes, browsers will limit access between IFRAMEs that are running on
> > different domains.  After the POST takes place, you won't have access to
> the
> > IFRAME body.
> >
> > ~Arne
> >
> >
> >
> > On Thu, Apr 24, 2008 at 2:18 AM, jfahrenkrug <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hi,
> >
> > > I have a file upload form in my gadget and it's target is an iframe
> > > within my gadget:
> >
> > > <form id="upload_form" action="http://MY_SERVER"; method="POST"
> > > enctype="multipart/form-data" target="upload_target_iframe">
> > > ......
> > > </form>
> >
> > > <iframe src="about:blank" id="upload_target_iframe"
> > > name="upload_target_iframe" onload="uploadFinishedCallback();"></
> > > iframe>
> >
> > > this is what the callback looks like:
> >
> > > function uploadFinishedCallback() {
> > >    console.log('uploadFinishedCallback');
> >
> > >    var i = $('#upload_target_iframe')[0];
> >
> > >    console.dir(i);
> >
> > >    if (i.contentDocument) {
> > >        var d = i.contentDocument;
> > >    } else if (i.contentWindow) {
> > >        var d = i.contentWindow.document;
> > >    }
> >
> > >    if (d.location.href == "about:blank") {
> > >        return;
> > >    }
> >
> > >    alert(d.body.innerHTML);
> > > }
> >
> > > When the gadget first loads, uploadFinishedCallback() is executed
> > > because of the onload attribute in the iframe. That's OK because the
> > > d.location.href == "about:blank" condition is true and so the function
> > > returns.
> >
> > > When I upload a file, however, the callback is called again (which is
> > > what I want), but then exceptions are thrown when I access d.location
> > > or d.body: access was denied to read the HTMLDocument.location
> > > property.
> >
> > > So is it generally forbidden to access iframes that I build myself via
> > > JavaScript?
> >
> > > - Johannes
> >
> > > --
> > >http://blog.springenwerk.com
> >
> > --
> > OpenSocial IRC - irc://irc.freenode.net/opensocial
> >
>


-- 
OpenSocial IRC - irc://irc.freenode.net/opensocial

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to