window.opener | not working in chrome

后端 未结 4 634
一个人的身影
一个人的身影 2020-12-06 21:09

I am having two html pages..i am calling parent window from child..All things works great.but in Chrome it fails..let me know the reason..

test1.html :-



        
4条回答
  •  被撕碎了的回忆
    2020-12-06 21:42

    the parent window can only be accessed using the parent variable. The following modification to opener1 function should make this possible

    function opener1(){
        try{
            if(parent.window.opener != null && !parent.window.opener.closed)
            {
              parent.window.opener.test1();
            }
    
        }catch(e){ alert(e.description);}       
    }
    

提交回复
热议问题