Skip to content

Commit

Permalink
Fixed a bug that currentURL is overwritten by URL of inline frame
Browse files Browse the repository at this point in the history
Fixed a bug that currentURL is overwritten by URL of inline frame
  • Loading branch information
NohohonNohon committed Jun 13, 2020
1 parent ac8f17f commit 5068f32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion src/ios/CDVThemeableBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]}];
Expand Down

0 comments on commit 5068f32

Please sign in to comment.