WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Feature]: Allow fullscreen Cross-Origin element programmatically

Open Poker-sang opened this issue 6 months ago • 5 comments

Describe the feature/enhancement you need

Although browsers have security concerns about prohibiting full-screen elements without user gestures, programs with embedded WebView2 sometimes need to allow the user to click on an external button to go fullscreen on a Cross-Origin element.

Is it possible to make an element fullscreen via AdditionalBrowserArguments or CoreWebView2.PermissionRequested?

The scenario/use case where you would use this feature

Taking over the web player with WinUI3

How important is this request to you?

Impactful. My app's user experience would be significantly compromised without it.

Suggested implementation

Allow fullscreen an element via AdditionalBrowserArguments or CoreWebView2.PermissionRequested

What does your app do? Is there a pending deadline for this request?

No response

Poker-sang avatar Jun 19 '25 09:06 Poker-sang

Add the moment I had to add a button in my dialog which causes the html to show a popup, maximized to the display.

ajtruckle avatar Jun 20 '25 22:06 ajtruckle

javascript allow to activate the fullscreen for an element, even for the entire document. find the video element on the page and execute "element.requestFullscreen();"

jls28 avatar Sep 24 '25 13:09 jls28

javascript allow to activate the fullscreen for an element, even for the entire document. find the video element on the page and execute "element.requestFullscreen();"

@jls28 No. requestFullscreen is not allowed to be called from code, you can only use Playwright or perform manual operations.

Poker-sang avatar Sep 24 '25 13:09 Poker-sang

Sorry, in my classic Win32 environment everything is nice. Javascript is available and fullscreen doesn't require any permission (like any normal browser).

Test page for requestFullscreen() : https://www.w3schools.com/jsref/api_fullscreen.asp

jls28 avatar Sep 25 '25 10:09 jls28

@jls28 I'm very sorry, I omitted a crucial condition: the video cannot be played in full screen when it's cross origin (embedded in an iframe).

Even after doing everything possible to remove all cross origin restrictions, it still doesn't work:

var opt = new CoreWebView2EnvironmentOptions
{
    AdditionalBrowserArguments = "--disable-web-security --disable-site-isolation-trials --proxy-auto-detect"
};

Do you have any good solutions?

Poker-sang avatar Sep 25 '25 13:09 Poker-sang