Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in-app-browser: actually support browser platform #4753

Open
1 of 3 tasks
fansanelli opened this issue Mar 27, 2024 · 0 comments
Open
1 of 3 tasks

in-app-browser: actually support browser platform #4753

fansanelli opened this issue Mar 27, 2024 · 0 comments

Comments

@fansanelli
Copy link

fansanelli commented Mar 27, 2024

I'm submitting a ... (check one with "x")

Current behavior:

Running in a browser, the constructor prints in console:
'Native: InAppBrowserOriginal is not installed or you are running on a browser. Falling back to window.open.'
so by example is not possibile to use any feature of the original plugin.
By example:
observable is undefined following the execution of const observable = browserRef.on("beforeload").

Expected behavior:

Using plugin browser proxy would expose more features, like the ".on()" method.

Steps to reproduce:

Related code:

import { InAppBrowser } from "@awesome-cordova-plugins/in-app-browser"
const iab = InAppBrowser;
const browserRef = iab.create("https://google.com");
const observable = browserRef.on("beforeload")

Other information:

Similar discussion on ionic forum:
https://forum.ionicframework.com/t/question-regarding-awesome-cordova-plugins-in-app-browser/233322/1
The possibile reason why is not working
ionic-team/capacitor#3813

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

[WARN] Error loading @ionic/angular package.json: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package' is
       not defined by "exports" in c:\Git\myproj\node_modules\@ionic\angular\package.json
[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module '@capacitor/ios/package'

       Require stack:
       - C:\Users\user\AppData\Roaming\nvm\v18.18.2\node_modules\@ionic\cli\lib\project\index.js
       - C:\Users\user\AppData\Roaming\nvm\v18.18.2\node_modules\@ionic\cli\lib\index.js
       - C:\Users\user\AppData\Roaming\nvm\v18.18.2\node_modules\@ionic\cli\index.js
       - C:\Users\user\AppData\Roaming\nvm\v18.18.2\node_modules\@ionic\cli\bin\ionic

Ionic:

   Ionic CLI                     : 6.20.3 (C:\Users\user\AppData\Roaming\nvm\v18.18.2\node_modules\@ionic\cli)
   Ionic Framework               : not installed
   @angular-devkit/build-angular : 17.0.9
   @angular-devkit/schematics    : 17.0.9
   @angular/cli                  : 17.0.9
   @ionic/angular-toolkit        : 9.0.0

Capacitor:

   Capacitor CLI      : 5.7.2
   @capacitor/android : 5.7.2
   @capacitor/core    : 5.7.2
   @capacitor/ios     : not installed

Utility:

   cordova-res : 0.15.4
   native-run  : 2.0.1

System:

   NodeJS : v18.18.2 (C:\Program Files\nodejs\node.exe)
   npm    : 9.8.1
   OS     : Windows 10

EDIT:
According to the latest doc: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
Passing target "_blank" is required to use addEventListener and I do, but the problem is that iab.create prints in console:
'Native: InAppBrowserOriginal is not installed or you are running on a browser. Falling back to window.open.'
so the _objectInstance will stay undefined and the "on" method will not do anything, even if according to the "Browser Quirks" of the "addEventListener" section of the doc only states that: 'loadstart, loaderror, message events are not fired.' letting think that others may work.

EDIT 2:
Changed title and description of the bug

@fansanelli fansanelli changed the title in-app-browser: on method returns undefined in-app-browser: actually support browser platform Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant