Skip to content
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

API to access WKWebViewConfiguration #977

Open
jasonbekolay opened this issue Aug 28, 2020 · 12 comments
Open

API to access WKWebViewConfiguration #977

jasonbekolay opened this issue Aug 28, 2020 · 12 comments

Comments

@jasonbekolay
Copy link

jasonbekolay commented Aug 28, 2020

Feature Request - API to access WKWebViewConfiguration

Motivation Behind Feature

Our team is upgrading from Cordova 5 to 6 and migrating from UIWebView to WKWebView. Our app used to use NSURLProtocol subclasses to handle certain requests from the UIWebView. This does not work with WKWebView. The new approach is to use WKURLSchemeHandler instances to handle requests made with a custom scheme. In order to do this, we need to register our scheme handlers with the WKWebViewConfiguration for the WebView. Right now, there does not seem to be a way to do this with public API. We also need to set the websiteDataStore on the WKWebViewConfiguration in order to set cookies for the WebView.

Feature Description

One option: Make CDVWebViewEngine a public class that class that can be extended. That way we can override createConfigurationFromSettings: and access WKWebViewConfiguration

Also open to any other option that provides access to WKWebViewConfiguration

Alternatives or Workarounds

Our current workaround is to use a post_install action in CocoaPods moves CDVWebViewEngine.h and CDVWebViewUIDelegate.h from private to public, then extending CDVWebViewEngine

CC: @lukemelia

@luissilvaos
Copy link
Contributor

That would be a very useful feature!

@ssraza
Copy link
Contributor

ssraza commented Sep 15, 2021

Any update on if/when this will gonna be supported?

@pinthegrenade
Copy link

Is there any progress in developing this feature?

@globules-io
Copy link

Bump, exact same need

@breautek
Copy link
Contributor

Any update on if/when this will gonna be supported?

Due to the volunteer nature of Apache projects, we can't really provide any timelines. AFAIK no one is looking into this feature, but with that being said, if there is a need for this feature (which there appears to be), anybody willing is free to develop and prepare a PR. A PR will likely be best way to discuss potential solutions since reviewers can see the actual code changes.

Additionally if you have any questions regarding developing this feature, you may ask our Slack Community or subscribe to our Dev Mailing List.

@globules-io
Copy link

@breautek what about #1157

@breautek
Copy link
Contributor

Looks like this might actually be resolved by #1050

@jasonbekolay
Copy link
Author

Looks like this might actually be resolved by #1050

I haven't tried this myself yet, but looks like that would solve my need to set scheme handlers.

There is one additional need that emerged after creating this issue that I also resolved with my workaround of subclassing CDVWebViewEngine. We need to hook into some of the WKNavigationDelegate calls, particularly webViewWebContentProcessDidTerminate:. Since CDVWebViewEngine already implemented that, overriding it was the quickest path forward. If there public API that allows me to do that another way, then I would be able to remove my workaround.

@GymotgM
Copy link

GymotgM commented Apr 8, 2024

Looks like this might actually be resolved by #1050

I haven't tried this myself yet, but looks like that would solve my need to set scheme handlers.

There is one additional need that emerged after creating this issue that I also resolved with my workaround of subclassing CDVWebViewEngine. We need to hook into some of the WKNavigationDelegate calls, particularly webViewWebContentProcessDidTerminate:. Since CDVWebViewEngine already implemented that, overriding it was the quickest path forward. If there public API that allows me to do that another way, then I would be able to remove my workaround.

@jasonbekolay
The same issue, as the NSURLProtocol of UIWeb no longer exists, WKWebb needs to update it. How did you handle it? Can you share it

@globules-io
Copy link

globules-io commented Apr 8, 2024

@GymotgM It's not been pushed AFAIK

@GymotgM
Copy link

GymotgM commented Apr 12, 2024

@breautek
Hello, as WKWebb no longer uses NSURLProtocol, have you organized or referenced the materials for switching to WKURLSchemeHandler? I am looking forward to more information to solve the bridging problem after replacing UIWeb with WKWebb and listing it on the Apple Store

@dpogue
Copy link
Member

dpogue commented Apr 12, 2024

@GymotgM Cordova iOS has used WKURLSchemeHandler for serving content since cordova-ios 6.0.0, released in 2020.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants