-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set additional wkWebView settings #1097
Comments
It's not possible at the moment |
Thanks, so it's not possible at all to set those variables? Or is there a workaround maybe? Sorry, no experience with Swift but would like to have those things in my app |
the only "workaround" is to manually edit the code to set the values you want |
Thank you ionic team for all your contributions to the community, allowing the ability to "allowsBackForwardNavigationGestures" would be much appreciated |
Thanks, certainly something we could explore adding down the road |
On our project we had the need to register a custom url scheme handler. This can only If this is a viable solution I could make a PR for this. In the meantime we swizzle |
What does everyone think of adding a static method that plugins can implement to allow them to modify the WKWebViewConfiguration? Something like this public static override func configureWKWebView(_ configuration: WKWebViewConfiguration) {
CAPLog.print("Wouldn't it be cool if this got called?")
configuration.ignoresViewportScaleLimits = true
} My only issue would plugins might step on each others toes, but I'm not sure how to possibly get around that. |
since the issue is about the webview settings, those can be changed at any time, and as plugins have a reference to the webview, they can change any of the settings, so I'll just close. @realityfilter @macdja38 as the |
In capacitor 3 you can use your own WebView, so you can configure it the way you want for changing values during runtime, better create a plugin of your own that exposes the properties you need |
So the recommended way in capacitor 3 is to use a custom ViewController and then implementing the
|
It depends on what you want to change, if they are values that can be changed at runtime I recommend creating a plugin that allows to change those values. |
Thanks for the reply! We just want to have |
@mb21 what did you end up doing? |
we ended up using a custom ViewController that looks like this: import UIKit
import Capacitor
class MyViewController: CAPBridgeViewController {
override func viewDidLoad() {
super.viewDidLoad()
webView!.allowsBackForwardNavigationGestures = true
}
} |
@mb21 thank you, much appreciated! |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
I am using Capacitor without Ionic and I want to set additional WKWebView settings like:
How would this be possible?
The text was updated successfully, but these errors were encountered: