window.opener alternatives

There are two ways to solve the problem:
Note: “window.opener” is not supported by IE if “showModalDialog” is been used.

1) Instead of “window.showModalDialog” use “window.open

2) If you want to use “window.showModalDialog” then do the following:

<script language="javascript" type="text/javascript">
    function YourFunction()
    {
        var opener = null;

        if (window.dialogArguments) // Internet Explorer supports window.dialogArguments
        { 
            opener = window.dialogArguments;
        } 
        else // Firefox, Safari, Google Chrome and Opera supports window.opener
        {        
            if (window.opener) 
            {
                opener = window.opener;
            }
        }       
        // write you code and refer "opener"
        window.close();
    }
</script>

Leave a Comment