diff --git a/README.md b/README.md index 2c8f2092e..c233f3945 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Additions: * Fixed a bug that loadstart,message event does not work. * Fixed a bug that enableviewportscale and mediaplaybackrequiresuseraction properties do not work. * Add customUserAgent Property +* Fixed a bug that currentURL is overwritten by URL of inline frame Sample call/config: diff --git a/src/ios/CDVThemeableBrowser.m b/src/ios/CDVThemeableBrowser.m index aedee0307..a71421442 100644 --- a/src/ios/CDVThemeableBrowser.m +++ b/src/ios/CDVThemeableBrowser.m @@ -635,7 +635,6 @@ - (void)webViewDidStartLoad:(WKWebView*)theWebView - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { NSURLRequest *request = navigationAction.request; - self.themeableBrowserViewController.currentURL = request.URL; NSURL* url = request.URL; NSURL* mainDocumentURL = request.mainDocumentURL; @@ -674,6 +673,7 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati // external app shouldStart = NO; } else if ((self.callbackId != nil) && isTopLevelNavigation) { + self.themeableBrowserViewController.currentURL = request.URL; // Send a loadstart event for each top-level navigation (includes redirects). CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:@{@"type":@"loadstart", @"url":[url absoluteString]}];