diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 6612a66..7415364 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -200,7 +200,7 @@ public class InAppBrowser extends CordovaPlugin { else if (action.equals("injectScriptCode")) { String jsWrapper = null; if (args.getBoolean(1)) { - jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); + jsWrapper = String.format("(function(){prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')})()", callbackContext.getCallbackId()); } injectDeferredObject(args.getString(0), jsWrapper); }