ionic 프레임워크에서 외부 URL 열기
프로젝트를 생성합니다.
ionic start ExampleProject blank --v2
cd ExampleProject
ionic platform add ios
ionic platform add android
cordova inappbrowser 를 설치합니다.
ionic plugin add cordova-plugin-inappbrowser
실행할 함수를 추가합니다.
launch(url) {
this.platform.ready().then(() => {
window.open(url, '_blank');
});
}
| Code | Description |
|---|---|
| window.open(‘http://example.com’, ‘_system’); | Loads in the system |
| browserwindow.open(‘http://example.com’, ‘_blank’); | Loads in the InAppBrowser |
| window.open(‘http://example.com’, ‘_blank’, ‘location=no’); | Loads in the InAppBrowser with no location bar |
| window.open(‘http://example.com’, ‘_self’); | Loads in the Cordova web view |
출처
- https://www.thepolyglotdeveloper.com/2014/07/launch-external-urls-ionicframework/
- https://www.thepolyglotdeveloper.com/2016/01/launch-websites-with-ionic-2-using-the-inappbrowser/
'Programming > Android' 카테고리의 다른 글
| [android] 사진 동영상 불러오기 (0) | 2017.05.19 |
|---|---|
| [android] 알뜰 구매 (0) | 2016.06.26 |
| [ionic] Promise resolve 으로 변경 (0) | 2016.05.17 |
| [ionic] open api 로 데이터 가져와서 적용하기 (0) | 2016.05.17 |
| [ionic] barcode scanner (0) | 2016.05.16 |
댓글