GithubHelp home page GithubHelp logo

Comments (5)

TwashRocketLoans avatar TwashRocketLoans commented on July 20, 2024 2

pretty sure his browser variable comes from the Ionic docs:

import { InAppBrowser } from '@ionic-native/in-app-browser';

constructor(private iab: InAppBrowser) { }


...


const browser = this.iab.create('https://ionicframework.com/');

browser.executeScript(...);

browser.insertCSS(...);
browser.on('loadstop').subscribe(event => {
   browser.insertCSS({ code: "body{color: red;" });
});

browser.close();

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024 1

browser is not an object being provided by this plugin. Where does this come from?
Did you ask on the Ionic Forum, Slack or any other support channel?

from cordova-plugin-inappbrowser.

willie001 avatar willie001 commented on July 20, 2024 1

The issue for me is directly related to #303. The amount of data I returned is too much and is truncated by Chrome. This invalidates the JSON string and the event is never fired.

Hope this helps someone that was struggling with this problem.

from cordova-plugin-inappbrowser.

willie001 avatar willie001 commented on July 20, 2024

This is a real issue.

The InAppBrowser executeScript used to work fine. After compiling my app again the "callback" or "promise" is not executed.

Here is my code that used to work:

const ref = cordova.InAppBrowser.open(someURL, '_blank', 'location=yes');

ref.addEevntListener('loadstop', () => {
  ref.executeScript({ code: 'someFunctionWithReturnValue();', (data) => {
    if (data[0] != null) {
      alert(JSON.parse(data[0]);
    }
  }
});

Here is a suggestion that it must be used as a promise but it also does not work:
ref.executeScript({code: 'someFunctionWithReturnValue();'}).then((data) => { alert(JSON.parse(data[0])); }).catch((e) => { alert(e); });

I really don't have an answer to this one. Already spend too much time on this issue. As I said, it used to work fine with the callback function but not anymore.

from cordova-plugin-inappbrowser.

jcesarmobile avatar jcesarmobile commented on July 20, 2024

Closing as duplicate of #303 as it has more information

from cordova-plugin-inappbrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.