How to get access from cross-site popup to window.opener?

前端 未结 2 885
借酒劲吻你
借酒劲吻你 2021-02-04 05:37

I\'ve making a widget and I need to redirect a parent window to certain url, after specific event in popup, whitch base on another domain. How a can do this.

win         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-04 06:01

    In certain situations it's possible to do that, but only with different subdomains, not completely different domains. See Cross site scripting on the same domain, different sub domains.

    But since postMessage() is widely available in current browsers, you should always prefer postMessage(), as @ian-kuca suggests.

提交回复
热议问题