You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Sergey Grebnov (JIRA)" <ji...@apache.org> on 2016/02/03 20:18:39 UTC
[jira] [Commented] (CB-7500) executeScript with callback
kills/blurs inAppBrowser window after callback exit
[ https://issues.apache.org/jira/browse/CB-7500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15130933#comment-15130933 ]
Sergey Grebnov commented on CB-7500:
------------------------------------
Testing latest platform and inappbrowser using the following code and don't see any problem
{code}
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
ref.addEventListener('loadstop', function() {
ref.executeScript({code:"alert('Hello');"}, function() {
console.log("ref.executeScript done");
});
});
{code}
> executeScript with callback kills/blurs inAppBrowser window after callback exit
> -------------------------------------------------------------------------------
>
> Key: CB-7500
> URL: https://issues.apache.org/jira/browse/CB-7500
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin InAppBrowser
> Affects Versions: 3.5.0
> Environment: Android 4.4.2 Samsung Galaxy Tab S
> Reporter: Andreas Imhof
> Assignee: Sergey Grebnov
> Labels: Android, Triaged, patch
> Original Estimate: 20m
> Remaining Estimate: 20m
>
> 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... :-)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org