# HTML Script

{% hint style="danger" %}
Due to the risk of breaking your page with these macros, they are disabled by default when the HAT plugin is installed. The administrator has to enable them manually in the Add-on Manager.
{% endhint %}

## Description

The HTML Script macro places a \<script> tag on your page.

There are two flavors of this macro:

* **HTML Script**: Has a body expected to be the script to be executed.
* **HTML Script (External)**: Has a no body but allows a URL to an external script.

These macros require good knowledge of Javascript and HTML in order to know what you do when you add them.

## Adding the Macro

1. Edit your page.
2. Select “+” => Other macros
3. Type in “html” in the Search box
4. Select the “HTML Script” or “HTML Script (External)” macro

## Macro Options: HTML Script

### **Type**

Specify the script type here, e.g. “text/javascript”. Leave this field empty if you are not sure.

## Macro Options: HTML Script (External)

### **Asynchronous Execution**

Select whether the script shall be executed asynchronously.

* **If selected:** The script is executed asynchronously with the rest of the page (the script will be executed as soon as it is loaded and while the rest of the page loads)
* **If not selected:** The script is executed when the page has finished loading

### **Character Set**

Enter the character set of the external script, e.g. “UTF-8”. Leave this field empty if you are not sure.

### **Deferred Execution**

Select whether the script shall be executed deferred, in the sequence of other defer scripts of the page..

* **If selected:** The script is executed asynchronously with the rest of the page (the script will be executed as soon as it is loaded and while the rest of the page loads, but in the sequence that other defer scripts are placed on the page)
* **If not selected:** The script is executed when the page has finished loading (in the sequence other defer scripts are placed on the page)

### **Source**

Enter the full URL of the external script.

### **Type**

Specify the script type here, e.g. “text/javascript”. Leave this field empty if you are not sure.

## Be Aware

{% hint style="info" %}
The scripts, external or not, will be executed each time you load the page or edit the page. Additionally, the scripts will also be executed in the preview area when you edit the macro.
{% 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://lewe.gitbook.io/html-and-aui-toolkit-for-confluence/html-macros/html-script.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.
