tips:cordova:inappbrowser

This is an old revision of the document!


inAppBrowser

With these modifications the hardware back button works within pages in an InAppBrowser.

In src/com/org/apache/corodova/inappbrowser/InAppBrowser.java change

private void goBack() {
   if (this.inAppWebView.canGoBack()) {
      this.inAppWebView.goBack();
   }
}

to (note public method)

public void goBack() {
   if (this.inAppWebView.canGoBack()) {
      this.inAppWebView.goBack();
   }
}
 
public boolean canGoBack() {
   return this.inAppWebView.canGoBack();
}

src/com/org/apache/corodova/inappbrowser/InAppBrowserDialog.java change

public void onBackPressed () {
   if (this.inAppBrowser == null) {
      this.dismiss();
   } else {
      // better to go through the in inAppBrowser
      // because it does a clean up            
      this.inAppBrowser.closeDialog();           
   }
}

to

public void onBackPressed () {
   if (this.inAppBrowser == null) {
      this.dismiss();
   } else {
      if (this.inAppBrowser.canGoBack()) {
         this.inAppBrowser.goBack();
      }  else {
         this.inAppBrowser.closeDialog();
      }
   }
}

Enable video autplay without gestures

In file src/com/org/apache/corodova/inappbrowser/InAppBrowser.java add (~647 row)

  inAppWebView.loadUrl(url);
  inAppWebView.setId(6);
  inAppWebView.getSettings().setLoadWithOverviewMode(true);
  inAppWebView.getSettings().setUseWideViewPort(true);
+ inAppWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
  • tips/cordova/inappbrowser.1424934887.txt.gz
  • Last modified: 2015/02/26 08:14
  • by scipio