WebBrowser.InvokeScript Method (String, array<String>[]()[])

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Executes a scripting function defined in the currently loaded document, and passes the function an array of string parameters.

Namespace: Microsoft.Phone.Controls
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)


Public Function InvokeScript ( _
    scriptName As String, _
    ParamArray args As String() _
) As Object
public Object InvokeScript(
    string scriptName,
    params string[] args


  • args
    Type: array<System..::.String>[]()[]
    A variable number of strings to pass to the function as parameters.

Return Value

Type: System..::.Object
The value returned by the scripting function.


InvokeScript takes a variable number of arguments that are passed into the scripting function designated by scriptName. The following code example passes the arguments "one", "two", and "three" to the scripting function "myFunction": args.

webBrowser.InvokeScript("myFunction", "one", "two", "three");

Script is turned off in the WebBrowser control by default. Set the IsScriptEnabled property to true if you want to enable scripting in your control.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0


Windows Phone

See Also


WebBrowser Class

InvokeScript Overload

Microsoft.Phone.Controls Namespace