<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebScriptObject/callWebScriptMethod(_:withArguments:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WebScriptObject(im)callWebScriptMethod:withArguments:"
  },
  "title" : "callWebScriptMethod(_:withArguments:)"
}
-->

# callWebScriptMethod(_:withArguments:)

Returns the result of executing a method in the scripting environment.

```
func callWebScriptMethod(_ name: String!, withArguments arguments: [Any]!) -> Any!
```

## Parameters

`name`

The name of the method to invoke.

`arguments`

The values to pass to the method.

## Return Value

The return value of the method. Returns [`WebUndefined`](/documentation/WebKit/WebUndefined) if an exception is thrown in the JavaScript environment or the method has no return value.

## Discussion

---

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)