Why is the browser name is missing from the userAgent string of the browser when running the MAUI Blazor project on iPad?

MAUI Blazor Developer 0 Reputation points
2024-07-01T10:06:33.4+00:00

Hi Guys,

I am working on a MAUI Blazor project. In it, I am handling the drag operation based on the browser name that is present in the userAgent property. The userAgent property gives the name of the browser when running in the windows. But when I run the same project on the iPad the name of the browser is missing in the userAgent. I want to know why the browser name is missing in the useAgent string when running the project on iPad. Also, I want to know if there is a way to manually set the userAgent.

userAgent string upon running the MAUI Blazor project on iPad: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko)"

In the same browser the userAgent string upon a webpage: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.6 Safari/605.1.15"

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,311 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 62,556 Reputation points
    2024-07-01T16:22:16.5033333+00:00

    Maui Blazor runs in a WebView, and the browser info is not included (as there is no browser). the IOS webview has a customUserAgent property can be set. see docs on "Configure the native WebView on iOS and Mac Catalyst" of IOS webview:

    https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/webview?view=net-maui-8.0&pivots=devices-ios

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.