cordova-plugin-inappbrowser icon indicating copy to clipboard operation
cordova-plugin-inappbrowser copied to clipboard

postmessage not available on iOS

Open ang3lx opened this issue 2 years ago • 8 comments

Hello

I need to close cordova iab after login, and I would do this with post message from browser in app to hybrid app I've done with this code:

function dLogin() {
	var messageObj = {
		status: 200,
		error: false,
		message: "test",
		user: {
			id: 1,
			token: "ABCDEF"
		}
	};
	var stringifiedMessageObj = JSON.stringify(messageObj);   
	window['webkit'].messageHandlers['cordova_iab'].postMessage(stringifiedMessageObj);
}

Android build: all works fine iOS build: window['webkit'] is not defined. I've tried with:

  • window.
  • webkit.
  • (window as any).webkit

what I'm wrong?

thanks in advance

ang3lx avatar Jan 09 '23 16:01 ang3lx

Any idea how to communicate between page and app on IOS ?

grekpg avatar Feb 10 '23 10:02 grekpg

Any update ??? Almost 3 Month without any response.......

LoicDev93 avatar Mar 29 '23 09:03 LoicDev93

This is why I hate ionic and anything related

scr2em avatar Jun 05 '23 12:06 scr2em

cordova is probably dying.. I don't understand why those of capacitorjs who have their browserinapp plugin don't implement the postMessage functionality so as to avoid installing these godforsaken plugins

ang3lx avatar Jun 05 '23 13:06 ang3lx

Any update ??? I have this same problem with [email protected]

GusLAN avatar Sep 28 '23 16:09 GusLAN

I recommend you follow up with us here: https://github.com/apache/cordova-discuss/issues

Unfortunately we are not in a position to promise any timelines as an essentially all-volunteer project.

Yeah I think it would be nice if Capacitor can adopt modernization of this kind of functionality.

Sent from my mobile

On Thu, Sep 28, 2023 at 12:51 PM Gustavo Lanza Duarte < @.***> wrote:

Any update ??? I have this same problem with @.***

— Reply to this email directly, view it on GitHub https://github.com/apache/cordova-plugin-inappbrowser/issues/988#issuecomment-1739688526, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL42UAZU7LIF7R4PUJE6O3X4WTJTANCNFSM6AAAAAATVTG76M . You are receiving this because you are subscribed to this thread.Message ID: @.***>

brody4hire avatar Sep 28 '23 16:09 brody4hire

Unfortunately capacitorjs plugin, at this moment, is very limited in functionality

ang3lx avatar Sep 28 '23 17:09 ang3lx

I may be late for the game, but I ran into the same issue and it seems the problem is that cordova cannot access some APIs on domains that are not whitelisted. I was able to solve it by setting navigation target to _blank like so: cordova.InAppBrowser.open(url, '_blank') after doing so webkit becomes available and I was able to send messages back to the app.

turanofff avatar Aug 14 '24 00:08 turanofff