Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7500

executeScript with callback kills/blurs inAppBrowser window after callback exit

    XMLWordPrintableJSON

Details

    Description

      Calling Javascript executeScript (inAppBrowser.js) WITH a callback into an inAppBrowser window kills/blurs this IAB window after the callback exits. Something like this also is mentioned in the author's comment in method 'injectDeferredObject' in 'inAppBrowser.java' on line 254.
      After inverstigating, I accidentally found a work-around/solution which helped on my Android 4.4.2 Samsung Galagy Tab S.

      SOLUTION:
      In 'inAppBrowser.java' on line 162:

      jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId());

      the 'prompt' statement should be assigned to a variable like:

      jsWrapper = String.format("var r=prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId());

      Adding 'var r=' prevents from InAppBrowser window being killed.
      Don't know why. Tell me...

      Attachments

        Activity

          People

            Unassigned Unassigned
            zeroeight Andreas Imhof
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 20m
                20m
                Remaining:
                Remaining Estimate - 20m
                20m
                Logged:
                Time Spent - Not Specified
                Not Specified