douqiu1604 2014-07-09 22:27
浏览 84
已采纳

JS opener.parent不会在ipad safari浏览器上触发

I was trying "this.opener.parent.doXero();" to call a function in the parent page and it works fine on desktop browsers. Unfortunately, it doesn't work on Ipad safari browser. Is there any solution for this matter?

My main page (index.php) has a link to open XERO authentication page (xero.php). Xero callback to xero.php and I have put the code below on the page. doXero function located in the index.php page.

<script>
    this.opener.parent.doXero();
    this.close();
</script>
  • 写回答

1条回答 默认 最新

  • duanmianxue2687 2014-07-13 17:44
    关注

    I found a solution for this. Hope this would help someone else too. Use following code under button/link event trigger.

    var win = window.open('yourpage.html');
                var timer = setInterval(function() {   
                    if(win.closed) {  
                        clearInterval(timer);  
                        functionToCall();  
                        }  
                }, 1000);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部