LoginSignup
7

More than 5 years have passed since last update.

PhoneGap リンクをブラウザで開く

Last updated at Posted at 2014-12-01

概要

PhoneGapでHTMLのまま、aタグでのリンクやwindow.openでリンクをするとアプリ内で開いてしまい戻れません。
OS標準のブラウザで開けるようにします。

コード

まず、PowerShell から以下のコマンドで、プラグインを追加します。

phonegap plugin add org.apache.cordova.inappbrowser

HTMLリンクは target を _system にすればOK。

html
<a href="http://www.google.com/" target="_system">LINK</a>

JSの場合は、以下。

js
window.open("http://www.google.com/","_system","");

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7