Using an iFrame, someone on my website can access their Facebook account, display a list of their photo albums, and then display photos from selected albums.
At the moment, when the user clicks a photo, I display a dialog box that shows the photo's path.
All of the above works perfectly.
My next step is to pass the photo's path info back to my web page, but I'm not sure how to do that because the object, to which I want to pass the data, is outside of the iFrame and therefore unknown to Facebook. I tried going top-down by referencing it through the DOM that contains the iFrame on my website...
parent.client.document.getElementById("FBPhoto").setValue(photoReference);
...but that didn't work.
Passing the argument to a PHP script, on my site, won't work because I don't want to fresh the page on my site (since that would cause the user to lose data).
From what you've provided it looks like your JS might be wrong.
Doing something like this might get you the value you need:
var photoReference = window.frames["iframe-name"].document.getElementById("FBPhoto");
Then you need to assign it to something:
MyObject.setValue(photoReference);
Note: window.frames["iframe-name"].document.getElementById("FBPhoto")
will return the DOM element called #FBPhoto
and will therefore be a big chunk of HTML. Your setValue()
method might not be expecting that.
I suggest you try running your script in Firefox with Firebug installed, which will allow you to dump the value of photoReference
to the console to see what you're getting back.