How to pass data from InAppBrowser to Inic4 app?

I have to call a web service submitting a web form with the POST method using InAppBrowser.
This web service redirects the browser to a page in which HTML I can read if the operation was successful or not.
So I have to pass a simple string from the browser to the app.

I’m using this code:

  const pageContent = '<form name="redirect" id="redirect" action="' + dataUrl + '" method="post">' +
	'<input type="hidden" name="PaReq" value="' + dataPareq + '">' +
	'<input type="hidden" name="TermUrl" value="' + dataTermUrl + '">' +
	'<input type="hidden" name="MD" value="' + dataPaymentId + '">' +
	'</form> <script type="text/javascript">document.getElementById("redirect").submit();</script>';

  const pageContentUrl = 'data:text/html;base64,' + btoa(pageContent);

  const browserRef = this.iab
	  pageContentUrl ,

  browserRef.executeScript({ code: 'localStorage.setItem("myresult", "OK" );'});

  browserRef.on('loadstop').subscribe(event => {
	const myResult =  localStorage.getItem('myresult');

In the InAppBrowser I write the variable myresult in the local storage, but when I read the same variable in the app it is null.
Is there a better way to do this?

Thank you very much


Did you ever have any luck with retrieving data from localStorage?