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

[Feature]: Setting a custom User Agent before a WebView navigates #4993

Open
dahaged opened this issue Dec 14, 2024 · 0 comments
Open

[Feature]: Setting a custom User Agent before a WebView navigates #4993

dahaged opened this issue Dec 14, 2024 · 0 comments
Assignees
Labels
feature request feature request

Comments

@dahaged
Copy link

dahaged commented Dec 14, 2024

Describe the feature/enhancement you need

I'm trying to add a custom string to the end of the User Agent by using the property CoreWebView2Settings.UserAgent, but since this property can only be used after the CoreWebView2 is already created, the user agent won't be updated when a WebView2 control is created, and it navigates to a webpage. So, if a webpage gets the User Agent while it is loading, it will just be the default User Agent from WebView2.

Having a way to set the User Agent while creating the WebView2 control will cover this case so the webpage will always get the correct User Agent string.

The scenario/use case where you would use this feature

This is useful for when you are creating a new WebView to a webpage that gets and uses the User Agent right away. Like creating a new window while launching a url.

How important is this request to you?

Nice to have. There are other ways to tackle this, but having official API support would be beneficial.

Suggested implementation

There could be an option for a custom User Agent in the constructor of either the WebView2 or the CoreWebView2 used to set the property before the WebView starts navigating.

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

No response

@dahaged dahaged added the feature request feature request label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request
Projects
None yet
Development

No branches or pull requests

2 participants