- ติดตั้ง Plugin
$ cordova plugin add https://git–wip–us.apache.org/repos/asf/cordova–plugin–inappbrowser.git
- จากนั้นเขียนโค๊ดดังนี้
<ion-view title=“Test Page”><ion-content><div class=“list”><a class=“item” href=“#” onclick=“window.open(‘http://www.rmutsv.ac.th/contact’, ‘_system’, ‘location=yes’); return false;”>Open a Browser</a></div></ion-content></ion-view>
หมายเหตุ
Code Description window.open(‘http://example.com’, ‘_system’); Loads in the system browser window.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