> For the complete documentation index, see [llms.txt](https://help.form.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.form.io/how/embedding-a-video.md).

# Embedding a Video

There may be situations where you would like to embed external media such as videos or other web-based html into your forms. This type of embedding can expose your forms to XSS vulnerabilities within your application.

To safely embed HTML, apply the [**Form.io Santize Config**](https://github.com/formio/formio.js/wiki/Form-Sanitize-Config) within your application settings. This code is a security mechanism that removes unsafe and potentially malicious content from raw HTML strings before presenting them to the end-user. Below is an example of applying the Sanitize Configuration to an embedded form within the application code. The video embed URL was applied to the [**Content** ](/form-building/layout-components.md#content)component on the form level.

```javascript
    window.onload = function() {
    Formio.createForm(document.getElementById('formio'), 
    'https://khvenypsypifjpi.form.io/embed2', 
        {
          sanitizeConfig: {
          allowedAttrs: ['ref', 'src', 'url', 'data-oembed-url'],
          allowedTags: ['iframe', 'oembed'],
          addTags: ['iframe', 'oembed'],
          addAttr: ['url', 'data-oembed-url']
        }
       });
 };
```

{% hint style="info" %}
Form.io utilizes the [**DOMPurify**](https://github.com/cure53/DOMPurify#can-i-configure-dompurify) library to generate the sanitized configurations, please follow the link for more details.
{% endhint %}

Since the configuration is applied to the application code, the HTML will not render within the Form.io project, but will successfully display within the application for the end user.

{% embed url="<https://codepen.io/JeriahFormio/pen/KKrvRyo>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.form.io/how/embedding-a-video.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
