如何在返回特定内容时自动关闭 InAppBrowser?

How can I close the InAppBrowser automatically when specific content is returned?

如何在 $cordovaInAppBrowser 进入我的网站和 returns 内容 "OK" 时自动关闭?我想这样做是为了避免在浏览器中显示关闭按钮 window。

有谁知道我怎样才能做到这一点?

你可以使用类似超时功能的东西,或者除了我建议制作自定义插件并使用它之外的均匀监听器。 @Blouraf 提供的解决方案非常老套。 我确实找到了一些关于推荐监听器的 cordova 插件的文档。

我确实找到了可以解决这个问题的网站condition.Here是参考link:https://developer.salesforce.com/forums/?id=906F00000009ALSIA2

样本编码:

authWindow.addEventListener('loadstop', function(e) {
var loc = e.url;
//when url is changed check if the url contains your specific callbackURL
if (loc.search(data.callbackURL) >= 0) {
//at this point close your inapp browser
//you will land on the index page within your application.
authWindow.close();
//your code after successful authentication
}
});