Ionic 3 Inapp browser communication problem with app . How to take value?

Dear pals,

I saw a post with URL here to take cross browser window communication.
I try same strategy for a payment with inapp web browser. The web provide
one local storage value . It’s source is

                                <table width="500" border="0" align="center" valign="top">
                                    <tr>
                                      <td colspan="4">&nbsp;</td>
                                    </tr>
                                   
                                    <tr>
                                      <td height="27" colspan="4" align="center"><b>Transactions completed. Click Back button to redirect</b></td>
                                    </tr>
                                        <tr>
                                      <td height="27" colspan="4" align="center"><a href="#" onclick="closew();">Click here to redirect</a></td>
                                    </tr>
                                    <tr><td width="75"></td>
                                    </tr>
                                </table>
                                 <input type="hidden" id="epayReceiptNo" name="epayReceiptNo" value="6029011000001">
                        </body>
                        <script type="text/javascript">
                        function setParameters()
                        {
                                var receiptno = document.getElementById('epayReceiptNo').value;
                                localStorage.setItem('epayReceiptNo', receiptno);   
                                //alert(localStorage.getItem("epayReceiptNo"));
                                window.close();
                        }
                       
                        function closew()
                        {
                            open(location, '_self').close();
                        }
                        </script>
       

in my pay.ts file i tried

var pageContent ='<html><head></head><body><form id="paymentForm" action="http://172.16.12.6/epaymentcur/onlinetest.php" method="post">'+
                  '<input type="hidden" name="BID" value="'+numBuildingID+'">'+
                  '<input type="hidden" name="LBID" value="'+lbid+'">'+
                  '<input type="hidden" name="ZoneID" value="'+zone+'">'+
                  '<input type="hidden" name="WardYear" value="'+wardyear+'">'+
                  '<input type="hidden" name="Category" value="'+intBuildingCategory+'">'+
                  '<input type="hidden" name="HashKey" value="'+hash+'">'+
                  '<input type="hidden" name="transactionID" value="'+trid+'">'+
                  '<input type="hidden" name="Mode" value="SAMAGRA">'+
                  '<form><script type="text/javascript">document.getElementById("paymentForm").submit();</script></body></html>';
  var pageContentUrl = 'data:text/html;base64,'+btoa(pageContent);
  var browserRef = window.open(pageContentUrl,"_blank","EnableViewPortScale=yes");
 
  browserRef.addEventListener( "loadstop", function() {
    this.browserRef.executeScript(
        { code: "localStorage.getItem( 'epayReceiptNo' )" },
        function( values ) {
          
            alert( values[ 0 ] );
            //console.log(values[0]);
        }
        
    );
});


But I could not get any result. Please advise …

Thanks

Anes