Pass parameter from popup window to parent on different domains [closed]
开发者_运维百科
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this questionI open popup window from Javascript that redirects to different domain. User performs few steps there and at the end popup is closed and the result is passed back to Javascript. I've tried calling window.opener.myfunction
but it doesn't work with different domains.
Is it possible to achieve that? I think problem is similar to Facebook connect, where in Javascript I get result of the authentication performed in popup window.
It doesn't work for different domains because the Same-Origin
policy applies and restricts access of scripts executing from a different domain. What you could do is pass the parameter as part of a query string argument:
Popup Window Opens -> http://mydomain/popup?name=value
http://mydomain/popup?name=value -> http://externaldomain/target?name=value
Through which the other domain would pass back the same parameter:
http://externaldomain/target?name=value -> http://mydomain/result?name=value
精彩评论