apache / cordova-plugin-inappbrowser

Apache Cordova InAppBrowser Plugin
https://cordova.apache.org/
Apache License 2.0
1.11k stars 2.14k forks source link

Calling window.print() does not work #1025

Open veelci opened 7 months ago

veelci commented 7 months ago

Feature Request

Enable the usage of window.print() when using the inappbrowser plugin for iOS and Android.

Motivation Behind Feature

The application I'm working on allows users to print the page using window.print(). This works when accessing the application via a web browser, but doesn't work when accessing the application via the inappbrowser plugin.

I'm not entirely sure why this doesn't work on iOS, but Android has chosen not to implement window.print in WebView.

Feature Description

I think the best way to go about this is to override window.print inside of the iOS and Android implementations of the inappbrowser plugin. I've been able to get window.print working on Android via this strategy. I think something similar may be possible in iOS.

The main downside I see to this is that this would override the iOS and Android implementations of window.print if they are ever implemented. In the case of Android, that seems unlikely to ever happen.