android端添加返回方法
This commit is contained in:
parent
bb76e20464
commit
0aebf7c325
@ -337,6 +337,20 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
pluginResult.setKeepCallback(true);
|
pluginResult.setKeepCallback(true);
|
||||||
this.callbackContext.sendPluginResult(pluginResult);
|
this.callbackContext.sendPluginResult(pluginResult);
|
||||||
}
|
}
|
||||||
|
else if(action.equals("back")){
|
||||||
|
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@SuppressLint("NewApi")
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if(canGoBack()) {
|
||||||
|
goBack();
|
||||||
|
} else {
|
||||||
|
closeDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,9 @@
|
|||||||
hide: function (eventname) {
|
hide: function (eventname) {
|
||||||
exec(null, null, 'InAppBrowser', 'hide', []);
|
exec(null, null, 'InAppBrowser', 'hide', []);
|
||||||
},
|
},
|
||||||
|
back: function(eventname) {
|
||||||
|
exec(null, null, 'InAppBrowser', 'back', []);
|
||||||
|
},
|
||||||
addEventListener: function (eventname, f) {
|
addEventListener: function (eventname, f) {
|
||||||
if (eventname in this.channels) {
|
if (eventname in this.channels) {
|
||||||
this.channels[eventname].subscribe(f);
|
this.channels[eventname].subscribe(f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user