Hello,
Please try adding js to adjust the Font size, and you can refer to the following code:
Custom WebView for MAUI
public class CustomWebView : WebView {
}
Xaml in Page
<local:CustomWebView x:Name="MyWebView" Source="XXX" HeightRequest="XXX' WidthRequest="XXX"> </local:CustomWebView>
Handler and setting delegate
Microsoft.Maui.Handlers.WebViewHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
{
if (view is CustomWebView)
{
CustomWebView customWebView = view as CustomWebView;
#if IOS
try
{
handler.PlatformView.NavigationDelegate = new MyDelegate(customWebView);
}
catch (Exception ex)
{
Console.WriteLine("Error at WebViewHandler: " + ex.Message);
}
#endif
}
});
WkWebviewDelagete
#if IOS
class MyDelegate : WKNavigationDelegate
{
public MyDelegate()
{
}
public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
{
// triple the size
NSString js = (NSString)"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust='200%'";
webView.EvaluateJavaScript(js, (r, e) =>
{
});
}
}
#endif
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.