ionic-team / cordova-plugin-ionic-webview

Web View plugin for Cordova, specialized for Ionic apps.
Apache License 2.0
487 stars 395 forks source link

Cant open a blank window in InAppBrowser #635

Closed zero-1 closed 3 years ago

zero-1 commented 3 years ago

Problem

Opening the InAppBrowser with target "_blank" in an Ionic app on iOS is not working. A new window is opened but the target url does not open.

Used the following instructions to install the plugin to the app... https://ionicframework.com/docs/native/in-app-browser/

The symptoms look exactly like https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/551

Issue can be reproduced in the following repo... https://github.com/zero-1/ionic-browser-demo

Tested on iOS simultor, on multiple devices running iOS 13.7 and iOS 14.1 .

Have tried downgrading the version to 4.2.0 and 4.1.3 with no effect.

package.json looks like....

{
  "name": "ionic-browser-demo",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~11.0.5",
    "@angular/core": "~11.0.5",
    "@angular/forms": "~11.0.5",
    "@angular/platform-browser": "~11.0.5",
    "@angular/platform-browser-dynamic": "~11.0.5",
    "@angular/router": "~11.0.5",
    "@ionic-native/core": "^5.31.1",
    "@ionic-native/in-app-browser": "^5.31.1",
    "@ionic-native/ionic-webview": "^5.31.1",
    "@ionic/angular": "^5.5.2",
    "cordova-ios": "6.1.1",
    "cordova-plugin-inappbrowser": "^4.1.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1100.5",
    "@angular/cli": "~11.0.5",
    "@angular/compiler": "~11.0.5",
    "@angular/compiler-cli": "~11.0.5",
    "@angular/language-service": "~11.0.5",
    "@ionic/angular-toolkit": "^3.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.1.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-ionic-webview": {}
    },
    "platforms": [
      "ios"
    ]
  }
}

The code to invoke the InAppBrowser ...

this.iab.create('https://app-deep-linking.web.app', '_blank', {
      location : 'no',
      zoom : 'no',
      hardwareback : 'no',
      hidden: 'no',
      clearcache: 'no',
      beforeload: 'yes',
      toolbar : 'no', 
    })

Have also tried playing around with "usewkwebview" property in the options with no effect.

There are no visible warnings/errors in the xcode console.

zero-1 commented 3 years ago

Also..

Ionic:

   Ionic CLI                     : 6.12.4 
   Ionic Framework               : @ionic/angular 5.5.3
   @angular-devkit/build-angular : 0.1100.7
   @angular-devkit/schematics    : 11.0.7
   @angular/cli                  : 11.0.7
   @ionic/angular-toolkit        : 3.0.0

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res (update available: 0.15.3) : 0.6.0
   native-run (update available: 1.3.0)   : 0.2.8

System:

   Android SDK Tools : 26.1.1 
   ios-deploy        : 1.11.3
   ios-sim           : 8.0.2
   NodeJS            : v12.16.3 
   npm               : 6.14.9
   OS                : macOS Catalina
   Xcode             : Xcode 12.1 Build version 12A7403
jcesarmobile commented 3 years ago

beforeload: 'yes' expects you to listen for beforeload event and confirm you allow to load the url, or show some error otherwise, your sample app has no listener for that event, so it doesn't load anything nor shows an error. If you remove beforeload: 'yes', from the create call it works.

zero-1 commented 3 years ago

That solved the problem. Thanks.

ipehimanshu commented 2 years ago

@zero-1 i have same type issue when using stripe hosted payment page into inappbrowser, can you help what type you added so it solve your issue?

Thanks

https://user-images.githubusercontent.com/26652038/174435765-5487879d-29c7-4739-8301-e4f4191d1730.mp4