简体   繁体   中英

JS opener.parent doesn't trigger on ipad safari browser

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>

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM