[ 
https://issues.apache.org/jira/browse/CB-8661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14381476#comment-14381476
 ] 

ASF GitHub Bot commented on CB-8661:
------------------------------------

GitHub user vladimir-kotikov opened a pull request:

    https://github.com/apache/cordova-plugin-inappbrowser/pull/97

    CB-8661 Return executed script result on Windows

    This fixes [CB-8661](https://issues.apache.org/jira/browse/CB-8661)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-plugin-inappbrowser CB-8661

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-inappbrowser/pull/97.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #97
    
----
commit ebca36fb42dafed4bf430dda6d6bee6da6601621
Author: Vladimir Kotikov <[email protected]>
Date:   2015-03-24T15:11:28Z

    CB-8661 Return executed script result on Windows

----


> executeScript doesn't return the a result on Windows platform
> -------------------------------------------------------------
>
>                 Key: CB-8661
>                 URL: https://issues.apache.org/jira/browse/CB-8661
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin InAppBrowser, Windows
>         Environment: Windows 8
> Latest version of Cordova 4.3.0
> Latest version of Plugin InAppBrowser 0.6.0
>            Reporter: John Little
>
> executeScript is supposed to provide a variable to the function called when 
> the script is completed as per this clip from the documentation :-
> If the injected script is of type code, the callback executes with a single 
> parameter, which is the return value of the script, wrapped in an Array. For 
> multi-line scripts, this is the return value of the last statement, or the 
> last expression evaluated.
> When running as a Windows app the array is empty.
> Looking in the Windows InAppBrowserProxy.js file, line 230 looks like this
>    op.oncomplete = function () { hasCallback && win([]); };
> So clearly no data is being passed ([]) is an empty array.
> According to the documentation from Microsoft :-
> https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.webview.invokescriptasync.aspx
> The invokeScriptAsync function can return a string.
> So if I modify line 230 to look like this
>   op.oncomplete = function (e) { hasCallback && win([e.target.result]); };
> I get a string returned to my callback function.
> You could also modify the similar line in the injectScriptFile function, as 
> it also calls invokeScriptAsync.
> I need the return value because the only way to comunicate between the page 
> in the IAB and the app is to poll some sessionStorage and wait for the page 
> to set some data.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to