# ClearScript

This amazing extension to Wisej.NET adds full support for server-side scripting using either VBScript, JScript or the latest Google V8 JavaScript engine. Scripts can access any object or class in the application and can attach to events fired by Wisej controls. Refer to [Microsoft’s ClearScript Reference](https://microsoft.github.io/ClearScript/Reference/html/R_Project_Reference.htm) for the ClearScript reference.

![](/files/-MiWVnWwUJrSTOjqntkl)

{% embed url="<https://github.com/iceteagroup/wisej-extensions/tree/master/Wisej.Ext.ClearScript>" %}
ClearScript Source Code
{% endembed %}

## How to Use

The **ClearScript** extension can be added to a Wisej.NET project using NuGet Package Manager.

{% embed url="<https://www.nuget.org/packages/Wisej-3-ClearScript>" %}

* Initialize engine with Wisej.Ext.ClearScript.ClearScript.Create (\<Type<)

This ClearScript extension supports the following Script [EngineTypes](/extensions/extensions/clearscript/api/wisej.ext.clearscript.enginetype.md):

* **V8**. Google V8 JavaScript.
* **JScript**. JavaScript.
* **VBScript**. VB Script.

Sample initialization:

```csharp
ScriptEngine engine;

engine = Wisej.Ext.ClearScript.ClearScript.Create(EngineType.JScript);
engine.AccessContext = GetType();
engine.AddHostObject("page", this);
engine.AddHostType("AlertBox", typeof(AlertBox));
```

Allows you to reference objects in your App from the Script:

```javascript
AlertBox.Show("Hello, World!");
page.Text = "Hello, World!";
```

{% hint style="info" %}
Find more information in our ClearScript example in [C#](https://github.com/iceteagroup/wisej-examples/tree/2.2/ClearScript) or in [VB.NET](https://github.com/iceteagroup/wisej-examples-vb/tree/main/ClearScript).
{% endhint %}

{% hint style="info" %}
Watch a video about ClearScript [online](http://wisej.s3.amazonaws.com/downloads/Examples/clearscript%20sample.mp4).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/extensions/extensions/clearscript.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
