diff --git a/Apps/MagnumOpus/Views/MessageWebView.swift b/Apps/MagnumOpus/Views/MessageWebView.swift
new file mode 100644
index 0000000..034d3dd
--- /dev/null
+++ b/Apps/MagnumOpus/Views/MessageWebView.swift
@@ -0,0 +1,64 @@
+import SwiftUI
+import WebKit
+
+#if os(macOS)
+struct MessageWebView: NSViewRepresentable {
+ let html: String
+
+ func makeNSView(context: Context) -> WKWebView {
+ let config = WKWebViewConfiguration()
+ config.preferences.isElementFullscreenEnabled = false
+ let prefs = WKWebpagePreferences()
+ prefs.allowsContentJavaScript = false
+ config.defaultWebpagePreferences = prefs
+ let webView = WKWebView(frame: .zero, configuration: config)
+ return webView
+ }
+
+ func updateNSView(_ webView: WKWebView, context: Context) {
+ let sanitized = sanitizeHTML(html)
+ webView.loadHTMLString(sanitized, baseURL: nil)
+ }
+}
+#else
+struct MessageWebView: UIViewRepresentable {
+ let html: String
+
+ func makeUIView(context: Context) -> WKWebView {
+ let config = WKWebViewConfiguration()
+ let prefs = WKWebpagePreferences()
+ prefs.allowsContentJavaScript = false
+ config.defaultWebpagePreferences = prefs
+ let webView = WKWebView(frame: .zero, configuration: config)
+ webView.scrollView.isScrollEnabled = false
+ return webView
+ }
+
+ func updateUIView(_ webView: WKWebView, context: Context) {
+ let sanitized = sanitizeHTML(html)
+ webView.loadHTMLString(sanitized, baseURL: nil)
+ }
+}
+#endif
+
+private func sanitizeHTML(_ html: String) -> String {
+ var result = html
+ let scriptPattern = ""
+ result = result.replacingOccurrences(of: scriptPattern, with: "", options: .regularExpression)
+ let eventPattern = "\\s+on\\w+\\s*=\\s*\"[^\"]*\""
+ result = result.replacingOccurrences(of: eventPattern, with: "", options: .regularExpression)
+ let imgPattern = "(]*?)\\ssrc\\s*=\\s*\"(https?://[^\"]*)\""
+ result = result.replacingOccurrences(of: imgPattern, with: "$1 data-blocked-src=\"$2\"", options: .regularExpression)
+ return """
+
+