apache / apache/cordova-plugin-inappbrowser
Ionic V6 - In app Browser doesn't open and doesn't show an error
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
I'm developing an APP using Ionic V6 with Angular and Cordova, but I'm having a problem using the In App Browser, when I use the app on the computer (ionic serve) it works fine, but when I test it on the phone (ionic cordova run android) the button that should open the web page does not work, there is simply no action in the app, nor does it show an error in the console.
I'm following this documentation: https://ionicframework.com/docs/native/in-app-browser
I've already used In App Browser in other apps, but with the older ionic and using this documentation: https://ionicframework.com/docs/v3/native/in-app-browser/ (which doesn't work in my app with ionic v6)
Running the ionic info command, I have this data:
```
Ionic:
Ionic CLI : 6.16.3 (C:\Users\Gabri\AppData\Roaming\nvm\v14.17.0\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 6.1.0
@angular-devkit/build-angular : 13.2.6
@angular-devkit/schematics : 13.2.6
@angular/cli : 13.2.6
@ionic/angular-toolkit : 6.1.0
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 9.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 4 other plugins)
Utility:
cordova-res (update available: 0.15.4) : 0.15.3
native-run (update available: 1.6.0) : 1.4.0
System:
Android SDK Tools : 26.1.1 (C:\Android\android-sdk)
NodeJS : v14.17.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.13
OS : Windows 10
```
In the code I use the following import:
```
import { InAppBrowser } from '@awesome-cordova-plugins/in-app-browser/ngx';
```
The construtor:
```
constructor(private iab: InAppBrowser) {}
```
And the function that opens the browser:
```
abrirProvaOuGabarito(arquivo: string) {
this.iab.create(this.servidorCaminhoBase + arquivo, '_system');
}
```
The generated link would be for example this: https://plataforma.aerosafeead.com.br/Uploads/simulados/prova-1653513297.pdf
I also tested with a google link, with HTTP and HTTPS, I also tried replacing `_system` with `_blank` or leaving nothing, I also tried opening the page with `window.open()` and putting a simple link in the HTML (`< a href="">`), I tested it on two different phones, but the result is always the same.
In my package.json the imports are these:
```
"@awesome-cordova-plugins/core": "^5.41.0",
"@awesome-cordova-plugins/in-app-browser": "^5.43.0",
```
InAppBrowser is in my `app.module.ts` providers
And in my config.xml I just added the `` different from what comes by default, I don't know if it interferes, but I used it because I run youtube videos in my app.
I've looked in several places and no solution solved, I don't know what else to change.
Contributor guide
Research direction
Begin by reproducing the Android behavior with the shown InAppBrowser.create(...) call and inspect the runtime logs. Review config.xml's allow-navigation setting and the InAppBrowser provider in app.module.ts, then compare the documented _system and _blank cases. The issue names no repository file, failing test, or clear acceptance condition, so the expected fix is not defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, angular, typescript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100