---
url: "https://vueda.dev/v3/reference/api/js/utils/html/functions/sanitizeMessage.md"
title: "sanitizeMessage"
---

# sanitizeMessage

## Overview

Sanitize a message to prevent XSS attacks.

Markup a server sends deliberately is supported through a restrictive allowlist: basic emphasis,
paragraphs, lists, and links. Everything else is removed. Text that arrives entity-encoded stays
encoded and therefore displays as the literal characters it stands for.

## Signature

`sanitizeMessage(message)`

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| <span id="param-message">message</span> | `string` | yes | The message to sanitize. |

### Returns

`string`

- The sanitized message.

## Source

`client/lib/utils/html.js:19`
