Skip to content

Commit e3db974

Browse files
committed
(ios) Move createIframeBridge to injectDeferredObject
Avoid failed script injections for pages which did not finish loading.
1 parent 632a395 commit e3db974

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ios/CDVUIInAppBrowser.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ -(void)createIframeBridge
362362

363363
- (void)injectDeferredObject:(NSString*)source withWrapper:(NSString*)jsWrapper
364364
{
365+
[self createIframeBridge];
365366
if (jsWrapper != nil) {
366367
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@[source] options:0 error:nil];
367368
NSString* sourceArrayString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
@@ -564,7 +565,6 @@ - (void)webViewDidStartLoad:(UIWebView*)theWebView
564565

565566
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
566567
{
567-
[self createIframeBridge];
568568
if (self.callbackId != nil) {
569569
// TODO: It would be more useful to return the URL the page is actually on (e.g. if it's been redirected).
570570
NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];

0 commit comments

Comments
 (0)