If you want to link to an external site and make it easy for the user to return to your PhoneGap app, try the well-named inAppBrowser (IAB for short). Here are the simple steps to implement it into an already-working PhoneGap project for iOS and Android.
<a href="http://bit.ly/iphonedevlog">Click here</a>
<a href="#" ontouchend="window.open('http://bit.ly/iphonedevlog','_blank','location=yes','closebuttoncaption=Return');">Click Here</a>
or as a button …
<input type="button" id="button1" onclick="window.open('http://bit.ly/iphonedevlog','_blank','location=yes','closebuttoncaption=Return');" value="Click Here">
Options (these work in Android and iOS):
_blank: Opens in the IAB. This is used in the example above. Replace _blank with any of the following if necessary:
_self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser.
_system: Opens in the system’s web browser.
location=yes: This is used in the example above. It displays the full URL of the page in the inAppBrowser in a location bar. This is the default IAB behavior, so if you leave the option out, IAB will show the location bar. Replace yes with no to refrain from displaying the location bar: location=no
Captioning the Done button:
The default return button in the IAB is to display the word “Done” in the button. I changed it to Return in the example above. I notice that when I used this option in the first of my links, all the following links on the page (which omitted this option) adopted the same wording as the first link. You can change it to another word by adding your own text after the equal sign: closebuttoncaption=
There are many more options for the IAB, especially for iOS. See one of the resource links at top.
1. Download the plugin. In your project’s folder in Terminal, type the add command::
cordova plugin add cordova-plugin-inappbrowser --save
2. Above all of your other js scripts between your <head> tags, put:
(My WordPress site is no longer displaying scripts when the angled brackets are closed, so I put a space after the first angled bracket like this: < script> so the whole script would display.)
3. Change your <body> to execute the script to …
4. Create the file and test on your device.