You aren't signed in     Sign In    Help

Flickr API / Discuss

Current Discussion

Flickr? I Hardly Know Her
Latest: 9 hours ago
flickr.photos.search with taken_date, user_id and tags.
Latest: 27 hours ago
photos.search difficulties
Latest: 2 days ago
Question on flickr.places.getChildrenWithPhotosPublic
Latest: 2 days ago
How to create subsets and collections using flickr API
Latest: 2 days ago
Peer to Peer Voting within Flickr Groups
Latest: 3 days ago
Flickr Groopy - "Views nn" Group Photo Manager
Latest: 4 days ago
Multiple domain API callback URL
Latest: 4 days ago
Flickr API ToS - 30 photos per page?
Latest: 4 days ago
Enlarging photos that have only one size
Latest: 4 days ago
How to get tokens using java and ruby?
Latest: 5 days ago
flickr.photos.getInfo returns invalid characters according to System.Xml.XmlReader in C#
Latest: 5 days ago
More...

Reading XML response from IFrame

view profile

sanjay_rana_2005 says:

Hi Everyone,

I am using the IFrame technique for uploading the photos. I am able to use the IFrame as a target to a form and can see the server's XML response appear in the IFrame.

Is there a way to read the XML response in the IFrame using javascript so that I can hide the IFrame and pop up a nice alert to show the result.

Thanks,
Sanjay.
Posted at 5:15AM, 26 July 2008 PST ( permalink )

view photostream

Silly Luis  Pro User  says:

I guess you could parse the contents of the iframe as a DOM tree (either directly or using XSLT) but, wouldn't it be easier for you to request a json reponse instead of the IFRAME technique?
Posted 6 months ago. ( permalink )

view photostream

sanjay_rana_2005 says:

Hi Luis,

Thanks.

I am really just a newbie at this point therefore starting off with a simple solution.

I am trying to find out what how to access the DOM tree of the IFrame so that I can retrieve the xml loaded into the IFrame.

Sanj.
Posted 6 months ago. ( permalink )

view photostream

Silly Luis  Pro User  says:

I'm not much versed on Javascript so I can't help you much; sorry.

Perhaps you could google for XML tutorials, etc.; or check in A List Apart, XML.com, etc.
Posted 5 months ago. ( permalink )

view photostream

myobis  Pro User  says:

I don't know the exact context of what you are trying to do.
However, It is usually not possible to read an iframe's content from the calling frame when the iframe's domain is different from the calling frame's domain (I guess it is the case because the iframe may be at flickr whereas the calling frame should be on your site).
This is a browser limitation to avoid Cross site scripting attacks.
This limitation is not implemented in thrusted scripting environments like HTML Applications (let me know if you want the javascript object path to get the iframe contents in this context).

What is usually done in this kind of situation is to setup a proxy page on your domain (your site) which you POST your request onto.
Then, server side your proxy page requests the flickr page (it somehow forwards your request to flickr) and forwards the flickr response as its own response. In this case, the iframe and the caller frame are on the same domain which allows the data access.
As you understand, the proxy is the tricky piece of work.

Also, to perform the actual POST and response retrieval, AJAX toolkits (internally using XMLHttpRequest) are commonly used. This doesn't prevent from using the above mentioned proxy.
Posted 5 months ago. ( permalink )

view photostream

sanjay_rana_2005 says:

Thanks! I have resorted to something more crude for now i.e.just display the result in pop-up. I will look into the proposed solutions in due course.
Posted 5 months ago. ( permalink )

Would you like to comment?

Sign up for a free account, or sign in (if you're already a member).

RSS 2.0 feedSubscribe to a feed of stuff on this page...</!!> Feed – Subscribe to Flickr API discussion threads
Add to My Yahoo!