diff --git a/src/Eppie.App/Eppie.App.Shared/Extensions/WebViewExtension.cs b/src/Eppie.App/Eppie.App.Shared/Extensions/WebViewExtension.cs index 280b9d92..145e8df4 100644 --- a/src/Eppie.App/Eppie.App.Shared/Extensions/WebViewExtension.cs +++ b/src/Eppie.App/Eppie.App.Shared/Extensions/WebViewExtension.cs @@ -5,22 +5,24 @@ namespace Tuvi.App.Shared.Extensions { public static class WebViewExtension { - public static string GetStringSource(DependencyObject obj) + public static string GetStringSourceWithDisabledJavaScript(DependencyObject obj) { - return (string)obj?.GetValue(StringSourceProperty); + return (string)obj?.GetValue(StringSourceWithDisabledJavaScriptProperty); } - public static void SetStringSource(DependencyObject obj, string value) + public static void SetStringSourceWithDisabledJavaScript(DependencyObject obj, string value) { - obj?.SetValue(StringSourceProperty, value); + obj?.SetValue(StringSourceWithDisabledJavaScriptProperty, value); } - public static readonly DependencyProperty StringSourceProperty = - DependencyProperty.RegisterAttached("StringSource", typeof(string), typeof(WebViewExtension), new PropertyMetadata("", OnStringSourcePropertyChanged)); - private static void OnStringSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + public static readonly DependencyProperty StringSourceWithDisabledJavaScriptProperty = + DependencyProperty.RegisterAttached("StringSourceWithDisabledJavaScript", typeof(string), typeof(WebViewExtension), new PropertyMetadata("", OnStringSourceWithDisabledJavaScriptPropertyChanged)); + private static void OnStringSourceWithDisabledJavaScriptPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is WebView webView) { + webView.Settings.IsJavaScriptEnabled = false; + webView.NavigateToString(e.NewValue as string ?? ""); } } diff --git a/src/Eppie.App/Eppie.App.Shared/Views/MessagePage.xaml b/src/Eppie.App/Eppie.App.Shared/Views/MessagePage.xaml index 9365b58d..da01b4cb 100644 --- a/src/Eppie.App/Eppie.App.Shared/Views/MessagePage.xaml +++ b/src/Eppie.App/Eppie.App.Shared/Views/MessagePage.xaml @@ -233,7 +233,7 @@ BorderBrush="#FFE0E0E0" BorderThickness="1"> -