diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift b/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift index 8d6d4b4f9e8..a1b5b28cb4f 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift @@ -380,7 +380,18 @@ extension BrowserViewController: WKNavigationDelegate { if let documentTargetURL = documentTargetURL { let domainForShields = Domain.getOrCreate(forUrl: documentTargetURL, persistent: !isPrivateBrowsing) let isScriptsEnabled = !domainForShields.isShieldExpected(.NoScript, considerAllShieldsOption: true) + + // Due to a bug in iOS WKWebpagePreferences.allowsContentJavaScript does NOT work! + // https://github.com/brave/brave-ios/issues/8585 + // + // However, the deprecated API WKWebViewConfiguration.preferences.javaScriptEnabled DOES work! + // Even though `configuration` is @NSCopying, somehow this actually updates the preferences LIVE!! + // This follows the same behaviour as Safari + // + // - Brandon T. + // preferences.allowsContentJavaScript = isScriptsEnabled + webView.configuration.preferences.javaScriptEnabled = isScriptsEnabled } // Cookie Blocking code below