Execute Method  
 

Executes the specified JavaScript synchronously in the current document and returns the result immediately.

Syntax

object.Execute( JavaScript, Response )

Parameters

JavaScript
A string which specifies the JavaScript that should be executed in the context of the current page being viewed.
Response
A string which will contain the response returned by the script, either as a JSON object or a JSON string value.

Return Value

Returns True if the method succeeds or False if the method fails.

Remarks

The Execute method evaluates a JavaScript expression within the context of the currently loaded page and returns the result synchronously. Unlike AsyncExecute, this method blocks while waiting for the script to complete. If the web page is non-responsive, this method will timeout after approximately two seconds. Applications should wait for the NavigationCompleted event before invoking script execution.

JavaScript must be enabled for scripts to execute. The AllowScripting property must be set to True when the browser is created. If scripting is disabled, this method will fail indicating that the operation is not supported.

The AddStartupScript method can be used to insert JavaScript which is executed whenever a new document is loaded.

See Also