@@ -105,6 +105,7 @@ public class InAppBrowser extends CordovaPlugin {
105
105
private static final String CLEAR_ALL_CACHE = "clearcache" ;
106
106
private static final String CLEAR_SESSION_CACHE = "clearsessioncache" ;
107
107
private static final String HARDWARE_BACK_BUTTON = "hardwareback" ;
108
+ private static final String TRIGGER_BACK_BUTTON = "triggerback" ;
108
109
private static final String MEDIA_PLAYBACK_REQUIRES_USER_ACTION = "mediaPlaybackRequiresUserAction" ;
109
110
private static final String INTENT_PROTOCOL_START = "intent:" ;
110
111
private static final String INTENT_PROTOCOL_INTENT = "#Intent;" ;
@@ -113,6 +114,7 @@ public class InAppBrowser extends CordovaPlugin {
113
114
private static final String HOGANGNONO_SCHEME = "hogangnono://" ;
114
115
private static final String SHOULD_PAUSE = "shouldPauseOnSuspend" ;
115
116
private static final Boolean DEFAULT_HARDWARE_BACK = true ;
117
+ private static final Boolean DEFAULT_TRIGGER_BACK = false ;
116
118
private static final String USER_WIDE_VIEW_PORT = "useWideViewPort" ;
117
119
private static final String TOOLBAR_COLOR = "toolbarcolor" ;
118
120
private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption" ;
@@ -140,6 +142,7 @@ public class InAppBrowser extends CordovaPlugin {
140
142
private boolean clearAllCache = false ;
141
143
private boolean clearSessionCache = false ;
142
144
private boolean hadwareBackButton = true ;
145
+ private boolean triggerBackButton = false ;
143
146
private boolean mediaPlaybackRequiresUserGesture = false ;
144
147
private boolean shouldPauseInAppBrowser = false ;
145
148
private boolean useWideViewPort = true ;
@@ -589,6 +592,21 @@ public boolean hardwareBack() {
589
592
return hadwareBackButton ;
590
593
}
591
594
595
+ /**
596
+ * Hogangnono - Has the user set the trigger back button to go back
597
+ * @return boolean
598
+ */
599
+ public boolean isTriggerBack () {
600
+ return triggerBackButton ;
601
+ }
602
+
603
+ /**
604
+ * Hogangnono - Execute javaScript for triggering back button
605
+ */
606
+ public void triggerBackButton () {
607
+ this .inAppWebView .loadUrl ("javascript:window.backbutton && window.backbutton()" );
608
+ }
609
+
592
610
/**
593
611
* Checks to see if it is possible to go forward one page in history, then does so.
594
612
*/
@@ -667,6 +685,12 @@ public String showWebPage(final String url, HashMap<String, String> features) {
667
685
} else {
668
686
hadwareBackButton = DEFAULT_HARDWARE_BACK ;
669
687
}
688
+ String triggerBack = features .get (TRIGGER_BACK_BUTTON );
689
+ if (triggerBack != null ) {
690
+ triggerBackButton = triggerBack .equals ("yes" ) ? true : false ;
691
+ } else {
692
+ triggerBackButton = DEFAULT_TRIGGER_BACK ;
693
+ }
670
694
String mediaPlayback = features .get (MEDIA_PLAYBACK_REQUIRES_USER_ACTION );
671
695
if (mediaPlayback != null ) {
672
696
mediaPlaybackRequiresUserGesture = mediaPlayback .equals ("yes" ) ? true : false ;
0 commit comments