public static void UpdateSource(this MauiWebView platformWebView, IWebView webView, IWebViewDelegate?webViewDelegate) { if (webViewDelegate != null) { webView.Source?.Load(webViewDelegate); } }
async void OnEvalAsyncClicked(object sender, EventArgs args) { MauiWebView.Eval("alert('text')"); var result = await MauiWebView.EvaluateJavaScriptAsync( "var test = function(){ return 'This string came from Javascript!'; }; test();"); EvalResultLabel.Text = result; }
void OnGoForwardClicked(object sender, EventArgs args) { Debug.WriteLine($"CanGoForward {MauiWebView.CanGoForward}"); if (MauiWebView.CanGoForward) { MauiWebView.GoForward(); } }
void OnGoBackClicked(object sender, EventArgs args) { Debug.WriteLine($"CanGoBack {MauiWebView.CanGoBack}"); if (MauiWebView.CanGoBack) { MauiWebView.GoBack(); } }
public static void UpdateGoForward(this MauiWebView platformWebView, IWebView webView) { if (platformWebView == null) { return; } if (platformWebView.WebView.CanGoForward()) { platformWebView.WebView.GoForward(); } platformWebView.UpdateCanGoBackForward(webView); }
void OnAllowMixedContentClicked(object sender, EventArgs e) { MauiWebView.On <Microsoft.Maui.Controls.PlatformConfiguration.Android>().SetMixedContentMode(MixedContentHandling.AlwaysAllow); }
void OnEvalClicked(object sender, EventArgs args) { MauiWebView.Eval("alert('text')"); }
void OnReloadClicked(object sender, EventArgs args) { MauiWebView.Reload(); }
void OnEnableZoomControlsClicked(object sender, EventArgs e) { MauiWebView.On <Microsoft.Maui.Controls.PlatformConfiguration.Android>().EnableZoomControls(true); }
public static void Eval(this MauiWebView platformWebView, IWebView webView, string script) { platformWebView.WebView.Eval(script); }
internal static void UpdateCanGoBackForward(this MauiWebView platformWebView, IWebView webView) { webView.CanGoBack = platformWebView.WebView.CanGoBack(); webView.CanGoForward = platformWebView.WebView.CanGoForward(); }
public static void UpdateReload(this MauiWebView platformWebView, IWebView webView) { // TODO: Sync Cookies platformWebView?.WebView.Reload(); }
public static void UpdateSource(this MauiWebView platformWebView, IWebView webView) { platformWebView.UpdateSource(webView, null); }