mirror of
https://github.com/shuto-cn/cordova-plugin-inappbrowser.git
synced 2025-03-31 20:02:41 +08:00
android端添加返回方法
This commit is contained in:
parent
bb76e20464
commit
0aebf7c325
@ -337,6 +337,20 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
pluginResult.setKeepCallback(true);
|
||||
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 {
|
||||
return false;
|
||||
}
|
||||
|
@ -60,6 +60,9 @@
|
||||
hide: function (eventname) {
|
||||
exec(null, null, 'InAppBrowser', 'hide', []);
|
||||
},
|
||||
back: function(eventname) {
|
||||
exec(null, null, 'InAppBrowser', 'back', []);
|
||||
},
|
||||
addEventListener: function (eventname, f) {
|
||||
if (eventname in this.channels) {
|
||||
this.channels[eventname].subscribe(f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user