dotnet / dotnet/maui

Global vs Per-View Configuration for HybridWebView

Open
#30,848 3 comments 0 reactions 0 assignees View on GitHub
area-controls-hybridwebview s/triaged t/enhancement ☀️
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Objective

Design the configuration model for HybridWebView playback options—determine what can be set globally versus per-WebView instance.

### Scope

- Identify which options need to be set before view instantiation (e.g., iOS WKWebViewConfiguration).
- Propose API for global config (static setters) and per-view config (constructor or property).
- Document limitations and trade-offs for each approach.

### Requirements

- Define the configuration lifecycle (when and how settings are applied).
- Specify precedence when both global and per-instance settings exist.
- Include API usage examples for both approaches.
- Ensure backwards compatibility and migration guidance.

### API & Usage Concepts

#### Proposed API Examples

```csharp
// Global configuration (static method)
HybridWebView.SetPlaysInline(true);
HybridWebView.SetAutoPlay(true);

// Per-WebView instance configuration
var config = new HybridWebViewConfig { PlaysInline = true, AutoPlay = true };
var webView = new HybridWebView(config);
```

#### Platform Note

On iOS, options must be set before WKWebView is constructed:
> In iOS, once the webview is constructed as above it is already too late unless we can pass in configuration info like a "HybridWebViewConfig" as an optional argument on construction.

### References

- [Original Issue #23747](https://github.com/dotnet/maui/issues/23747)
- [HybridWebViewConfig proposal](https://github.com/dotnet/maui/issues/23747#issuecomment)

Contributor guide

Open the contributing guide

Research direction

Start with the HybridWebView entry point and read Original Issue #23747 plus the HybridWebViewConfig proposal. Map which playback options must be applied before WKWebView construction, then document global and per-instance APIs, precedence, lifecycle, compatibility, migration guidance, and usage examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.