开发者

Pass parameter from popup window to parent on different domains [closed]

开发者 https://www.devze.com 2023-02-17 20:32 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_运维百科Want to improve this question? Update the question so it focuses on one problem only
Closed. This question needs to be more focused. It is not currently accepting answers.
开发者_运维百科

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 question

I 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
0

精彩评论

暂无评论...
验证码 换一张
取 消