Cordova InAppBrowser is blank on iPad iOS 10

雨燕双飞 提交于 2019-12-13 06:29:38

问题


This issue happens only on iPad with iOS 10.

When I try to use InAppBrowser with presentationstyle set to fullscreen , it pops up fine but when I tap on the Done button, I got a blank screen. Looks like it doesn't destroy itself properly.

I am using Cordova 6.4.0 and InAppBrowser plugin 1.6.1


回答1:


Not sure if this is applicable to you but I was also having an issue with a blank screen after tapping the Done button, but it was only happening in landscape. Still worth a shot though:

cordova-plugin-statusbar & cordova-plugin-inappbrowser apparently don't play nice together so try either deleting cordova-plugin-statusbar all together or add an event listener on exit:

openUrl(url) {
  let ref = cordova.InAppBrowser.open(url, '_blank', options);

  ref.addEventListener('exit', () => {
    StatusBar.hide();
    StatusBar.show();
  })
}

StatusBar.hide() is what fixed the issue for me.

EDIT: As noted by René, a blank column exists with the fix noted above. In order to completely fix the issue in both iPhone and iPad without having to remove the plugin, wrap the StatusBar.show() call inside a setTimeout of a second:

openUrl(url) {
  let ref = cordova.InAppBrowser.open(url, '_blank', options);

  ref.addEventListener('exit', () => {
    StatusBar.hide();

    setTimeout( () => {
      StatusBar.show();
    }, 1000)
  })
}

Thanks René!



来源:https://stackoverflow.com/questions/42072730/cordova-inappbrowser-is-blank-on-ipad-ios-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!