tryImageElementFromUrl Function

Try to create an html Image element from a URL.

tryImageElementFromUrl(url: string, skipCrossOriginCheck: booleanfalse): Promise<HTMLImageElement | undefined>

@returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL, or to undefined if an exception occurred.

@see imageElementFromUrl

Parameter Type Description
url string The URL pointing to the image data.
skipCrossOriginCheck boolean Set this to true to allow an image from a different origin than the web app to load. Default is false.

Returns - Promise<HTMLImageElement | undefined>

A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL, or to undefined if an exception occurred.

Defined in

Last Updated: 21 November, 2024