<!--
{
  "availability" : [
    "iOS: 8.0.0 - 14.0.0",
    "iPadOS: 8.0.0 - 14.0.0",
    "macCatalyst: 13.1.0 - 14.0.0",
    "macOS: 10.10.0 - 11.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKPreferences/javaScriptEnabled",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKPreferences(py)javaScriptEnabled"
  },
  "title" : "javaScriptEnabled"
}
-->

# javaScriptEnabled

A Boolean value that indicates whether JavaScript is enabled.

```
var javaScriptEnabled: Bool { get set }
```

## Discussion

The default value is <doc://com.apple.documentation/documentation/Swift/true>. Setting this property to <doc://com.apple.documentation/documentation/Swift/false> disables JavaScripts that are loaded or executed by the webpage. This setting does not affect user scripts. See [`WKUserContentController`](/documentation/WebKit/WKUserContentController).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)