apache / cordova-plugin-inappbrowser

Apache Cordova InAppBrowser Plugin
https://cordova.apache.org/
Apache License 2.0
1.11k stars 2.15k forks source link

Options not working #545

Closed BenSegni closed 4 years ago

BenSegni commented 4 years ago

Bug Report

iab options are not working as described

Problem

I set options for the in-app browser and the settings only affect location, nothing else

What is expected to happen?

setting: const options = "location=yes,hidden=no,beforeload=yes,toolbarcolor=#000000"; should change the toolbar to black, but stays grey

What does actually happen?

just stays grey, but location if set to no, works.

Information

const options = "location=yes,hidden=no,beforeload=yes,toolbarcolor=#000000"; const browser = this.iab.create(this.sponsorLink, '_blank', options);

this is my code above, but location when setting to no, removes the toolbar, but any other settings applied, just has no effect

Command or Code

const options = "location=yes,hidden=no,beforeload=yes,toolbarcolor=#000000"; const browser = this.iab.create(this.sponsorLink, '_blank', options);

Environment, Platform, Device

Android and IOS - working with Ionic v5.2.7

Version information

Ionic v5.2.7 package.json

{ "name": "sideline-demo", "version": "0.0.1", "author": "Ionic Framework", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "start": "ionic-app-scripts serve", "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "lint": "ionic-app-scripts lint" }, "dependencies": { "@angular/animations": "8.2.5", "@angular/common": "^8.2.5", "@angular/compiler": "8.2.5", "@angular/compiler-cli": "8.2.5", "@angular/core": "^8.2.5", "@angular/forms": "^8.2.5", "@angular/http": "7.2.15", "@angular/platform-browser": "8.2.5", "@angular/platform-browser-dynamic": "8.2.5", "@angular/router": "8.2.5", "@ionic-native/core": "^5.13.0", "@ionic-native/file": "^5.13.0", "@ionic-native/in-app-browser": "^5.13.0", "@ionic-native/onesignal": "^5.13.0", "@ionic-native/screen-orientation": "^5.13.0", "@ionic-native/social-sharing": "^5.13.0", "@ionic-native/splash-screen": "~5.13.0", "@ionic-native/status-bar": "~5.13.0", "@ionic/pro": "2.0.4", "@ionic/storage": "2.2.0", "@types/mocha": "^5.2.7", "angular": "^1.7.8", "cordova-android": "8.0.0", "cordova-ios": "^5.0.1", "cordova-plugin-device": "^2.0.3", "cordova-plugin-file": "6.0.2", "cordova-plugin-inappbrowser": "3.1.0", "cordova-plugin-ionic": "^5.4.4", "cordova-plugin-ionic-keyboard": "^2.2.0", "cordova-plugin-ionic-webview": "^4.1.1", "cordova-plugin-screen-orientation": "^3.0.2", "cordova-plugin-splashscreen": "^5.0.3", "cordova-plugin-statusbar": "^2.4.3", "cordova-plugin-whitelist": "^1.3.4", "cordova-res": "^0.6.0", "es6-promise-plugin": "^4.2.2", "ionic": "^5.2.7", "ionic-angular": "3.9.8", "ionicons": "4.6.3", "lodash": "^4.17.15", "native-run": "^0.2.8", "ngx-smart-modal": "^7.1.1", "node-sass": "^4.12.0", "npm-check-updates": "^3.1.22", "onesignal-cordova-plugin": "2.5.2", "rxjs": "6.5.3", "rxjs-compat": "^6.5.3", "sw-toolbox": "3.6.0", "zone.js": "0.10.2" }, "devDependencies": { "@ionic/app-scripts": "^3.2.4", "typescript": "~3.6.2", "ionic-plugin-deeplinks": "1.0.17" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-screen-orientation": {}, "cordova-plugin-inappbrowser": {}, "onesignal-cordova-plugin": {}, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" }, "cordova-plugin-x-socialsharing": { "ANDROID_SUPPORT_V4_VERSION": "24.1.1+" }, "cordova-plugin-file": {}, "ionic-plugin-deeplinks": { "URL_SCHEME": "sidelineapp", "DEEPLINK_SCHEME": "https", "DEEPLINK_HOST": "sidelineapp.io", "ANDROID_PATH_PREFIX": "/", "ANDROID_2_PATH_PREFIX": "/", "ANDROID_3_PATH_PREFIX": "/", "ANDROID_4_PATH_PREFIX": "/", "ANDROID_5_PATH_PREFIX": "/", "DEEPLINK_2_SCHEME": " ", "DEEPLINK_2_HOST": " ", "DEEPLINK_3_SCHEME": " ", "DEEPLINK_3_HOST": " ", "DEEPLINK_4_SCHEME": " ", "DEEPLINK_4_HOST": " ", "DEEPLINK_5_SCHEME": " ", "DEEPLINK_5_HOST": " " } }, "platforms": [ "android", "ios" ] } }

Checklist

Bhagirath123 commented 4 years ago

you need to use option like this

options : InAppBrowserOptions = { hideurlbar:'yes', hardwareback:'no', hidenavigationbuttons:'yes', toolbarcolor:'#081F48', fullscreen:'yes', closebuttoncolor:'#081F48', hidden:'no', zoom:'no', shouldPauseOnSuspend:'no', disallowoverscroll:'no', toolbar:'no', enableViewportScale:'no', presentationstyle:'fullscreen' };

timbru31 commented 4 years ago

Thanks @Bhagirath123 - that's correct. A string is required for the plain JS usage, with Ionic's Native wrapper it's an object.

ilclaudio commented 4 years ago

Thanks @Bhagirath123 - that's correct. A string is required for the plain JS usage, with Ionic's Native wrapper it's an object.

I'm using :

I'm importing it in this way: import {InAppBrowser} from '@ionic-native/in-app-browser/ngx';

And a string is required as options parameter.

timbru31 commented 4 years ago

If you believe this is wrong, please raise an issue with https://github.com/ionic-team/ionic-native - we are not responsible for the wrapper code.

ilclaudio commented 4 years ago

Hi, I'm only saying that to use this plugin with Ionic4 you have to pass the options as a string and not as an object. I'm using this method and it works.