开发者

Callback to parent function from child not working in IE?

开发者 https://www.devze.com 2023-03-08 09:28 出处:网络
I have the functions below and they work fine in firefox and chrome but dont seem to work in IE. Is this because IE opens in new windows and not tabs like the others?

I have the functions below and they work fine in firefox and chrome but dont seem to work in IE.

Is this because IE opens in new windows and not tabs like the others?

Parent JS

    var wnd = null;
    function openPdf() {
        wnd = window.open('www.example.com');
    }

    function closeWnd() {
        if (wnd != null) {
            wnd.close();
       开发者_Python百科 }   
    alert('Closed');
    }

Child JS

    function parent_callback() {
        setTimeout("window.opener.closeWnd()",2000);
    }

Thanks


wont fix the whole problem but will improve at least

function parent_callback() {
        setTimeout(function (){
          window.opener.close();
         },2000);
    }

show your error for a better solution

0

精彩评论

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

关注公众号