cordova-plugin-ionic-webview icon indicating copy to clipboard operation
cordova-plugin-ionic-webview copied to clipboard

Feature Request: Add support for cordova PreferredContentMode setting

Open kushagranigam opened this issue 3 years ago • 1 comments

With Cordova iOS v6.1.0, a new preference PreferredContentMode is added for use. This setting allows developers to set preferredContentMode configuration for WKWebView available in iOS 13.0 and newer versions.

At present, adding iOS platform using ionic cordova platform add ios creates a CordovaLib project with CDVWebViewEngine.m in Private/Plugins directory that provides usage for this setting. Although, this code will not execute unless cordova-plugin-ionic-webview is removed from plugins. Once removed from plugins, the platform can be detected properly on iPadOS 13+ when mobile value is provided for PreferredContentMode preference in config.xml. In other cases, the platform is detected as desktop web browser.

kushagranigam avatar Sep 02 '20 19:09 kushagranigam

I got a strange bug when the WebView is hanging after some manipulations with sqlite database (cordova-sqlite-storage). In that case the watchdog is restarting WebView after 30 seconds. It doesn't matter if the debugger was connected or not. Also there's no errors on console. After some investigation I tried to switch the contentMode to "mobile" and it helped me. The app is working fine as on iOS 12.

Apple API documentation: WKWebpagePreferences::preferredContentMode

Created PR #612

I think this property affects not only the User Agent but also the behavior of WebView engine, probably it uses some desktop features that lead to unexpected bugs.

a-kalmykov avatar Sep 17 '20 09:09 a-kalmykov