In the PhoneGap development process, you need to call external Web pages, but also out of whitelist security restrictions, you can use the Inappbrowser plugin.
Http://plugins.cordova.io/#/package/org.apache.cordova.inappbrowser
Use case:
http://blog.csdn.net/gapapp/article/details/17093601
The Inappbrowser plugin, as its name implies, is the app's built-in browser. When using the Inappbrowser plugin, the default phone return key is pressed to exit the built-in browser instead of the history fallback.
Workaround: Change two places
1, Org.apache.cordova.inappbrowser\src\android\inappbrowserdialog.java
Find the Onbackpressed method and change to the following
public void onbackpressed () { if (This.inappbrowser = = null) { This.dismiss (); } else { //better to go t Hrough the Inappbrowser //Because it does a clean up if (This.inAppBrowser.canGoBack ()) {This.inAppBrowser.go Back ();} else {this.inAppBrowser.closeDialog ();} } }
2, Org.apache.cordova.inappbrowser\src\android\inappbrowser.java
Find the GoBack method and change private to public
public void GoBack () { if (This.inAppWebView.canGoBack ()) { this.inAppWebView.goBack ();} }
And then add a method
public Boolean cangoback () {return this.inAppWebView.canGoBack ();}
PhoneGap New Window Inappbrowser Plugin