반응형

Launch Websites With Ionic 2 Using The InAppBrowser

https://github.com/apache/cordova-plugin-inappbrowser


inappbrowser - http://ionicframework.com/docs/native/in-app-browser/


In App Browser

$ ionic plugin add --save cordova-plugin-inappbrowser
$ npm install --save @ionic-native/in-app-browser

Repo: https://github.com/apache/cordova-plugin-inappbrowser

Launches in app Browser




Create a Fresh Ionic 2 Project
Shell
1
2
3
4
ionic start ExampleProject blank --v2
cd ExampleProject
ionic platform add ios
ionic platform add android



1
cordova plugin add cordova-plugin-inappbrowser


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import {Platform, Page} from 'ionic-framework/ionic';
 
 
@Page({
    templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
 
    static get parameters() {
        return [[Platform]];
    }
 
    constructor(platform) {
        this.platform = platform;
    }
 
    launch(url) {
        this.platform.ready().then(() => {
            cordova.InAppBrowser.open(url, "_system", "location=true");
        });
    }
}






.

반응형

+ Recent posts