You're right, what you want will be blocked by the browser due to security reasons (same origin policy).
What can you do:
Reload the form in the iframe and pass it the data that you get from js sdk, you can even POST the data in the iframe (for example, facebook does canvas applications).
You should be able to change the location of the iframe, but only the hash part (fragment) that will not cause the iframe to reload.
In the iframe, you should know the location changes and extract data from the fragment.
The problem is that this method is likely to ruin the browser history.
Find another cross-domain solution, maybe easyXDM ?
Edit
Here are two options for implementing the first option:
1) Using GET
<iframe id="userform"></iframe> <script type="text/javascript"> </script>
2) Using POST in iframe
<form method="POST" action="USER_FORM_URL" target="userform" id="postForm"> <input type="hidden" name="fbResponse" id="fbResponseInput" /> </form> <iframe name="userform"></iframe>
Then, in the iframe itself, get the data (either from GET or POST) and create the user form accordingly.
<script type="text/javascript"> // load and init FB JS SDK FB.api("me", function(response) { document.getElementById("fbResponseInput").value = JSON.stringify(response); document.getElementById("postForm").submit(); }); </script>
Nitzan tomer
source share