Function: isAllowedUrl()
ts
function isAllowedUrl(href, protocols?): boolean;Whether href is safe to put in a link.
Absolute URLs must use one of protocols. Relative URLs (/path, #id, page.html) are allowed. Control characters and whitespace are removed before the check, because browsers ignore them in the scheme (java\tscript: runs as javascript:).
Parameters
| Parameter | Type | Default value |
|---|---|---|
href | string | undefined |
protocols? | readonly string[] | DEFAULT_PROTOCOLS |
Returns
boolean