简体   繁体   中英

Passing data from my hybrid Ionic 2 App to the inAppBrowser

I need to pass some data ( Login-Name and Password ) to some website, which I open with the inAppBrowser.

I save the data before into the IOS - keychain.

When I open the inAppBrowser via a button, the first page, which is shown is this login page. At the 2 fields, i want to insert the data from the keychain.

Is it possible to do that? And if it is, how do I do?

I'm using ionic v2.

Thank you in advance

ps I think I saw something working for ionic v1, but nothing for v2.

You can just use the InAppBrowser to send a url with the parameters as your url queries

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

username:string;
password:string;

var openBrowser(url){
 let browser = new InAppBrowser('url', '_self'); //change it to _system if you want to open in System Browser
}

this.openBrowser('http://yourwebsite.com/api/action?username='+this.username+'&password='+this.password);

And then in your website you can just take the values from the query and fill those values into your username and password input fields.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM