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

GitToTheHub pushed a commit to branch 
pr-fix-android-open-with-system-overwrote-active-callback-context
in repository 
https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git

commit 9ca73f4e9e88ef8f7efa10ddeab4c17b5d2b743d
Author: Manuel Beck <[email protected]>
AuthorDate: Wed May 6 18:25:19 2026 +0200

    fix(android): open with `_system` overwrote the active callback context
    
    - Changed execute() to skip updating this.callbackContext when 
target="_system", preserving the active _blank InAppBrowser's event channel
    - This ensures beforeload events continue to be delivered after external 
opens
---
 src/android/InAppBrowser.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index bb3495f..81d591a 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -163,13 +163,17 @@ public class InAppBrowser extends CordovaPlugin {
      */
     public boolean execute(String action, CordovaArgs args, final 
CallbackContext callbackContext) throws JSONException {
         if (action.equals("open")) {
-            this.callbackContext = callbackContext;
             final String url = args.getString(0);
             String t = args.optString(1);
             if (t == null || t.equals("") || t.equals(NULL)) {
                 t = SELF;
             }
             final String target = t;
+            // Keep the existing callback channel when opening _system from 
inside
+            // an active InAppBrowser instance (e.g. from beforeload handling).
+            if (!SYSTEM.equals(target)) {
+                this.callbackContext = callbackContext;
+            }
             final HashMap<String, String> features = 
parseFeature(args.optString(2));
 
             LOG.d(LOG_TAG, "target = " + target);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to