You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2019/02/10 17:06:40 UTC

[cordova-plugin-inappbrowser] branch master updated: GH-417: Handle non-default target attribute values (e.g. target=on links in WKWebView implementation on iOS (#418)

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f4b729  GH-417: Handle non-default target attribute values (e.g. target=on links in WKWebView implementation on iOS (#418)
9f4b729 is described below

commit 9f4b72982abf50ddc54a34bd3748b6a3aad3be57
Author: Dave Alden <dp...@gmail.com>
AuthorDate: Sun Feb 10 17:06:35 2019 +0000

    GH-417: Handle non-default target attribute values (e.g. target=on links in WKWebView implementation on iOS (#418)
---
 src/ios/CDVWKInAppBrowser.m | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m
index 121223f..7deb6d0 100644
--- a/src/ios/CDVWKInAppBrowser.m
+++ b/src/ios/CDVWKInAppBrowser.m
@@ -573,7 +573,14 @@ static CDVWKInAppBrowser* instance = nil;
     }
     
     if(shouldStart){
-        decisionHandler(WKNavigationActionPolicyAllow);
+        // Fix GH-417: Handle non-default target attribute
+        // Based on https://stackoverflow.com/a/25853806/777265
+        if (!navigationAction.targetFrame.isMainFrame){
+            [theWebView loadRequest:navigationAction.request];
+            decisionHandler(WKNavigationActionPolicyCancel);
+        }else{
+            decisionHandler(WKNavigationActionPolicyAllow);
+        }
     }else{
         decisionHandler(WKNavigationActionPolicyCancel);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org