apache / apache/cordova-ios

API to access WKWebViewConfiguration

Open
#977 12 comments 11 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
1k
Avg merge
12h 11m
Merged PRs (30d)
18

Description

# 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

Contributor guide

Open the contributing guide

Research direction

Start by reading CDVWebViewEngine.h and CDVWebViewUIDelegate.h, focusing on createConfigurationFromSettings: and how the WKWebViewConfiguration is created. Compare the current private-header workaround with possible public API designs; done means a decided, supported way to configure WKURLSchemeHandler and websiteDataStore without moving private headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.