CB-9445 Improves executeScript callbacks on iOS
This closes #125 Signed-off-by: Shazron Abdullah <shazron@apache.org>
This commit is contained in:
parent
290ea0ac9c
commit
65821f907d
@ -30,7 +30,6 @@
|
||||
@class CDVInAppBrowserViewController;
|
||||
|
||||
@interface CDVInAppBrowser : CDVPlugin {
|
||||
BOOL _injectedIframeBridge;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;
|
||||
|
@ -266,11 +266,8 @@
|
||||
|
||||
- (void)injectDeferredObject:(NSString*)source withWrapper:(NSString*)jsWrapper
|
||||
{
|
||||
if (!_injectedIframeBridge) {
|
||||
_injectedIframeBridge = YES;
|
||||
// Create an iframe bridge in the new document to communicate with the CDVInAppBrowserViewController
|
||||
[self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){var e = _cdvIframeBridge = d.createElement('iframe');e.style.display='none';d.body.appendChild(e);})(document)"];
|
||||
}
|
||||
// Ensure an iframe bridge is created to communicate with the CDVInAppBrowserViewController
|
||||
[self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){_cdvIframeBridge=d.getElementById('_cdvIframeBridge');if(!_cdvIframeBridge) {var e = _cdvIframeBridge = d.createElement('iframe');e.id='_cdvIframeBridge'; e.style.display='none';d.body.appendChild(e);}})(document)"];
|
||||
|
||||
if (jsWrapper != nil) {
|
||||
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@[source] options:0 error:nil];
|
||||
@ -407,7 +404,6 @@
|
||||
|
||||
- (void)webViewDidStartLoad:(UIWebView*)theWebView
|
||||
{
|
||||
_injectedIframeBridge = NO;
|
||||
}
|
||||
|
||||
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
|
||||
|
Loading…
Reference in New Issue
Block a user