1

I have one simple cordova app, inside, I call one web application AngularJS. I need to call javascript/plugin inAppPurchase from web application.

Call external webapp from index.html cordova android.

<script>
  document.addEventListener("deviceready", onDeviceReady, false);
  function onDeviceReady() {
    if (navigator.network.connection.type == Connection.NONE) {
      networkError()
    } else {
      loadApp()
    }
  }

  function loadApp() {
    navigator.app.loadUrl("http://192.168.0.102:8000/")
  }
</script>

I have to call this plugin: InAppPurchase - https://github.com/AlexDisler/cordova-plugin-inapppurchase

It's plugin work fine on index.html on cordova app, but not work when call on webapplication:

Uncaught ReferenceError: inAppPurchase is not defined

Code inside external webapp to call plugin/javascript:

<script>
  inAppPurchase.getProducts(['vaga_de_veiculo'])
    .then(function (products) {
      console.log(products);
    })
  .catch(function (err) {
    console.log(err);
  });
</script>

I tried inAppBrowser, but, no success. Sorry, my bad english.

  • 1
    It looks like it might be possible to do this, but it's a bit of a hack. You might want to have a look at this [answer](http://stackoverflow.com/questions/21984688/how-to-get-access-to-phonegap-api-from-a-remote-page) – Andre May 18 '16 at 12:54
  • Thank you @Andre! This answer worked for me: http://stackoverflow.com/a/36696250/5453988 – Lucas Ferreira da Costa May 20 '16 at 15:35

0 Answers0