-
Notifications
You must be signed in to change notification settings - Fork 8
Integration: WebViewJavascriptBridge
Ed Sakabu edited this page Apr 10, 2015
·
1 revision
CASA on Rails provides integration support generally for native platforms via Cordova integration, but for iOS apps specifically, there's an alternate approach used by platforms such as Facebook Mobile. WebViewJavascriptBridge is an iOS library that provides for simple communication between native and web.
The client-side invocation:
var connectWebViewJavascriptBridge = function(callback) {
if (window.WebViewJavascriptBridge) {
callback(WebViewJavascriptBridge)
} else {
document.addEventListener('WebViewJavascriptBridgeReady', function() {
callback(WebViewJavascriptBridge)
}, false)
}
};
connectWebViewJavascriptBridge(function(bridge) {
bridge.send({"title":"Some University Mobile App","uri":"http://m.example.edu","icon":"http://m.example.edu/appicon.png","ios":{"id":"1111111","scheme":"someeduapp"},"android":{"package":"someeduapppackage","scheme":"someeduapp"}});
});See the project README for implementation details on the iOS side.