Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postmessage not available on iOS #988

Open
ang3lx opened this issue Jan 9, 2023 · 8 comments
Open

postmessage not available on iOS #988

ang3lx opened this issue Jan 9, 2023 · 8 comments

Comments

@ang3lx
Copy link

ang3lx commented Jan 9, 2023

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

@grekpg
Copy link

grekpg commented Feb 10, 2023

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

@LoicDev93
Copy link

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

@scr2em

This comment was marked as off-topic.

@ang3lx

This comment was marked as off-topic.

@GusLAN
Copy link

GusLAN commented Sep 28, 2023

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

@brodycj

This comment was marked as off-topic.

@ang3lx

This comment was marked as off-topic.

@turanofff
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants