diff --git a/Sources/PrivacyDashboard/PrivacyDashboardController.swift b/Sources/PrivacyDashboard/PrivacyDashboardController.swift index e6d823eef..7b2454cd2 100644 --- a/Sources/PrivacyDashboard/PrivacyDashboardController.swift +++ b/Sources/PrivacyDashboard/PrivacyDashboardController.swift @@ -114,6 +114,12 @@ public protocol PrivacyDashboardControllerDelegate: AnyObject { public func setup(for webView: WKWebView) { self.webView = webView webView.navigationDelegate = self + + if #available(iOS 16.4, macOS 13.3, *) { + webView.isInspectable = true + } else { + // Fallback on earlier versions + } setupPrivacyDashboardUserScript() loadStartScreen() diff --git a/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift b/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift index 39e300a1e..98f9c8025 100644 --- a/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift +++ b/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift @@ -333,7 +333,7 @@ final class PrivacyDashboardUserScript: NSObject, StaticUserScript { atbEntry = "" #endif let js = """ - const json = { + window.onGetToggleReportOptionsResponse({ "data": [ { "id": "siteUrl", @@ -358,8 +358,7 @@ final class PrivacyDashboardUserScript: NSObject, StaticUserScript { {"id": "userRefreshCount"}, {"id": "locale"}, ] - } - window.onGetToggleReportOptionsResponse(json); + }); """ evaluate(js: js, in: webView) }