Reference · Draw a bracket, a table or a road to the final
safeUrlfunction
Whether an image address is one a drawing will load: http(s), a relative path, or a data:image/.
Import it
import { safeUrl } from "@johnmorrisdotca/taisen-brackets";
Definition
function safeUrl(url: string): boolean
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The address. |
Returns
boolean
true when the address is allowed.
Examples
import { safeUrl } from "@johnmorrisdotca/taisen-brackets";
console.log(safeUrl("https://example.com/mark.svg"), safeUrl("javascript:alert(1)"));true falseWhat it prints (run when this page was built)