Skip to content

[feat] Add limit_navigations_to_app_bound_domains into WebviewBuilder and WebviewWindowBuilder #13847

@zphrs

Description

@zphrs

Describe the problem

Extension of wry#1587. On iOS Service Workers are disabled in WKWebView by default.

This can be fixed by setting App-Bound Domains for iOS in Info.plist in addition to running
webViewConfiguration.limitsNavigationsToAppBoundDomains = YES; on the WKWebViewConfiguration object. Then all WKWebViews used in the app are able to use Service Workers [source].

It additionally further locks down the WKWebView to only allow requests to resources from domains which are explicitly whitelisted. That said, I mainly want the feature so I can use a Service Worker in my Tauri App.

Describe the solution you'd like

I'd like to extend the API in Wry as of (tauri-apps/wry#1588) into the WebviewBuilder and the WebviewWindowBuilder structs in Tauri.

Alternatives considered

I considered using a Tauri plugin; unfortunately the reference to the WKWebviewConfiguration object is not made available to a Tauri plugin, at least as far as I could tell.

Additional context

App-Bound Domains Blog Post: https://webkit.org/blog/10882/app-bound-domains/
StackOverflow issue about enabling Service Workers in WKWebViews: https://stackoverflow.com/questions/49673399/service-workers-unavailable-in-wkwebview-in-ios-11-3/64155509#64155509

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions