Cordova 从inappbrowser phonegap获取html?

Cordova 从inappbrowser phonegap获取html?,cordova,inappbrowser,Cordova,Inappbrowser,我在phonegap上申请。当我点击工具栏上的关闭按钮时,我需要从AppBrowser中获取内容html,但它不起作用。 这是我的代码: var handleClose = function() { // get content html from here } ref.addEventListener('exit', handleClose); 有人能帮我吗?为了将来帮助任何人,我刚刚偶然发现了同样的问题并找到了解决办法 var inAppRef=cordova.InAppBro

我在phonegap上申请。当我点击工具栏上的关闭按钮时,我需要从AppBrowser中获取内容html,但它不起作用。 这是我的代码:

var handleClose = function() {
    // get content html from here
}

ref.addEventListener('exit', handleClose);

有人能帮我吗?

为了将来帮助任何人,我刚刚偶然发现了同样的问题并找到了解决办法

var inAppRef=cordova.InAppBrowser.open('http://apache.org“,”空白“,”位置=是“;
inAppRef.addEventListener('loadstop',function(){
不允许执行脚本({
代码:“document.getElementsByTagName('html')[0].innerHTML”
},函数(html){
警报(html);
});

});根据Ralphonzo的回答,对于当前版本的应用内浏览器(v3.0.0)和ionic(v4.6.0)以及cordova(v7.1.0)和Angular(v7.2.8),这对我来说很有用:

ngOnInit() {
  this.browser = this.iab.create(domain + sso_url, '_blank', {});

  this.browser.on('loadstart').subscribe((event: InAppBrowserEvent) => {
    this.browser.executeScript({code: 'document.getElementsByTagName("html")[0].innerHTML'}).then( html => { console.log(html) });
  }
}

您是否正在启动函数
handleClose
功能??请指定:什么不起作用什么不起作用?获取html或方法执行?是的,函数handleClose工作正常,但我需要获取应用程序浏览器中的内容htmlwhat?你想得到什么。具体点。共享更多代码。在我的例子中,console.log永远不会显示。有什么想法吗?安卓设备,IAB3.2Ionic4。。。