apache / cordova-plugin-inappbrowser

Apache Cordova InAppBrowser Plugin
https://cordova.apache.org/
Apache License 2.0
1.12k stars 2.16k forks source link

Ionic 4 in appbrowser Messsage event not receving in IOS #701

Open supriyamalusare opened 4 years ago

supriyamalusare commented 4 years ago

Bug Report

I am using in app browser to open one external link. We require to capture message which is post from that link. In app browser plugin has one "message" event listener. That message event is not working in ios. But for android it is working.

Problem

In ios unable to listen message event which is posted from the site. In android it is listening properly.We are using below code to listen message event .

this.browser = this.inAppBrowser.create("url", '_blank', browserOptions); this.browser.show(); this.browser.on("message").subscribe(() => { alert("message recevied") })

What is expected to happen?

From above code it should give me the alert as message recevied.

What does actually happen?

It is not displaying an alert. Message event is not listened in ios.

Information

Command or Code

this.browser = this.inAppBrowser.create("url", '_blank', browserOptions); this.browser.show(); this.browser.on("message").subscribe(() => { alert("message recevied") })

Environment, Platform, Device

We are receiving this issue in iPhone 13.3 and other version of ios.

Version information

Checklist

Ross-Rawlins commented 4 years ago

I have also just noticed this. I thought it might be ios putting the app to sleep while its in the background but the background plugin does not resolve this. Its for all event listeners FYI.

nieok commented 4 years ago

hello guys, have you found any solution to this?

timbru31 commented 4 years ago

The example code posted above is from Ionic Native's Wrapper code, besides that this issue is missing the required version information.

Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md

nieok commented 4 years ago

we are alternating between the uiwebview and the wkwebview versions with same code setup. The wkwebview version does not call our functions on loadstop and loadstart.

timbru31 commented 4 years ago

The wkwebview version does not call our functions on loadstop and loadstart.

That sounds like a completely different issue. This one is about the messaging.

srdmathur commented 3 years ago

I am also facing similar issue. The postMessages sent through code are not working at all but same messages executed through safari console are working. But not as per the expectation. When the postMessage is executed from console the message listener triggers but only when the inappbrowser gets closed. It even maintains a queue of the postMessages triggered. However, it is working fine in android.

ryanwillis commented 3 years ago

Anyone ever get to the bottom of this?