这是我的父窗口代码
var host = document.domain; var client_api_key='43415795136947951'; $("#load_pdf").on("click",function(){ var popup; popup = window.open("http://editsoftsolutions.com/amarujala/developer/apilogin.php ?host="+host+"&client_api_key="+client_api_key, "new window",'height=400,width=500,left=400,top=200,\n\ //resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,\n\ //directories=no, status=yes'); popup.focus(); return false }); function getdata(data) { alert(data); }
http://azeemkhan.me/Dev/loginwithsso.php
然后我打开新窗口并允许访问数据有错误
Uncaught SecurityError: Blocked a frame with origin "http://editsoftsolutions.com" from accessing a frame with origin "http://azeemkhan.me". Protocols, domains, and ports must match.
这是子窗口代码
if (window.opener != null && !window.opener.closed) { var jArray = ; userdata =JSON.stringify(jArray); window.opener.getdata(userdata); } window.close();