window.opener is undefined on Internet Explorer

前端 未结 2 1181
野趣味
野趣味 2020-12-06 14:14

When I am trying to access an element of my Parent window from a Pop-up window, I am getting window.opener as undefined.

var opener = window.ope         


        
2条回答
  •  有刺的猬
    2020-12-06 14:58

    You can use the showModalDialog function and pass arguments to it, if the browser used is IE. Simply pass window object as an argument.

    After that you can access the arguments from the modal window using dialogArguments.

    More details can be found in the documentation here: http://msdn.microsoft.com/en-us/library/ms533723%28VS.85%29.aspx

    Example of retrieve:

    window.showModalDialog(theURL, window);
    
    //in the modal dialog you can use this to retrieve the window.
    var openerWindow = window.dialogArguments;
    

提交回复
热议问题