Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8585 - Fix Javascript Disabling <NoScript> (#8586)
Browse files Browse the repository at this point in the history
- Fix Javascript Disabling not working
  • Loading branch information
Brandon-T authored Jan 4, 2024
1 parent 61e7719 commit e35b435
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e35b435

Please sign in to comment.