Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sending data from webView to native Android/iOS layer in hybrid mobile app
function sendToNative(data: string) {
if (/android/i.test(window.navigator.userAgent)) {
if (window.quicketNative) {
return window.quicketNative.send(data);
}
}
let frame = document.createElement('iframe');
frame.width = '100';
frame.height = '1';
frame.src = `quicketNative:send:${encodeURIComponent(data)}`;
document.body.appendChild(frame);
document.body.removeChild(frame);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment