0

I have button which will open an popup window, popup window redirect to several page and return to one final page,

Now i would like to get status of last page in parent open window

what i tried this

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        ?>
        <button id="imageinstagram">Images</button>
        <script src="jquery-1.7.2.min.js" type="text/javascript"></script>
        <script>
            $(document).ready(function(){
                $('#imageinstagram').click(function(){
                    window.open("./login.php",'','menubar=no,status=no,width=200,height=200') ;
                });

            });
            function HandlePopupResult(result) {
                alert("result of popup is: " + result);
            }
        </script>
    </body>
</html>

Now login.php redirect to success.php

success.php has following code

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>        
            <script>
            function CloseMySelf(sender) {
                try {
                    window.opener.HandlePopupResult(sender.getAttribute("result"));
                }
                catch (err) {}
                window.close();
                return false;
            }

            CloseMySelf();
        </script>

    </body>
</html>

Still My parent window is not getting any alert

Community
  • 1
  • 1
Ashish Kasma
  • 3,594
  • 7
  • 26
  • 29

1 Answers1

0

I have done silly mistake without understanding the code :(

silly mistake in javascript of child window.

<script>
            function CloseMySelf() {
                try {
                    window.opener.HandlePopupResult('false');
                }
                catch (err) {}
                window.close();
                return false;
            }

            CloseMySelf();
        </script>
Ashish Kasma
  • 3,594
  • 7
  • 26
  • 29