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

# isForMainFrameOnly

A Boolean value that indicates whether to inject the script into the main frame or all frames.

```
var isForMainFrameOnly: Bool { get }
```

## Discussion

When the value of this property is <doc://com.apple.documentation/documentation/Swift/true>, the web view injects the script only into the main frame. When the value is <doc://com.apple.documentation/documentation/Swift/false>, the web view injects the script into all frames.

---

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)