Created
February 14, 2017 15:59
-
-
Save agustinsivoplas/af7cca40850287736b1b3f94d3919f63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
</br> | |
</br> | |
<p>Communication Test</p> | |
<input type="button" value="Send Token" onclick="__external.postMessage('sendToken', 'ajkdshaskj8979867');"/> | |
<input type="button" value="Set Cart Items" onclick="__external.postMessage('setCartItemsNumber', '2');"/> | |
</body> | |
<script> | |
var isMobile = { | |
Android: function() { | |
return navigator.userAgent.match(/Android/i); | |
}, | |
iOS: function() { | |
return navigator.userAgent.match(/iPhone|iPad|iPod/i); | |
} | |
}; | |
var __external = { | |
postMessage: function(messageType, params) { | |
if(isMobile.Android()) { | |
Android.postMessage(messageType, params); | |
} | |
if(isMobile.iOS()) { | |
window.webkit.messageHandlers[messageType].postMessage(params); | |
} | |
} | |
}; | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment