Monday, January 9, 2017

How cordova UIWebview passes javascript exec call into native code

When UIWebView is used, iosExec js method in cordova.js will be called by a cordova js bridge call.
The pokeNative method will be called to create an iframe element with the src of "gap://ready". When an iframe is added into the DOM tree, it will invoke the native side code in CDVUIWebViewDelegate.m method

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
Which will check whether the scheme is "gap", if so the native code will start to handle the bridge call.




No comments:

Post a Comment