---
title: "addUserScript(_:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkusercontentcontroller/adduserscript(_:)"
---

# addUserScript(_:)

Injects the specified script into the webpage’s content.

## Declaration

```swift
func addUserScript(_ userScript: WKUserScript)
```

## Parameters

- `userScript`: The user script to add to the web view’s current page.

## See Also

### Adding and Removing Custom Scripts

- [removeAllUserScripts()](webkit/wkusercontentcontroller/removealluserscripts().md)
- [userScripts](webkit/wkusercontentcontroller/userscripts.md)
