Indicates how to handle cross-origin image requests.
Object.defineProperty(ImageLoader.prototype, 'imgCrossOrigin',
get: function(),
set: function(value)
)
A string indicating what the crossOrigin
attribute of the HTMLImageElement used in the request should be set to. The default value is 'anonymous'. Any string is acceptable, but other important values include 'use-credentials' and null.
This property is only useful with ImageLoaderUrlMode.ImageUrl. For ImageLoaderUrlMode.AjaxDataUrl or ImageLoaderUrlMode.AjaxXml, see DefaultAjaxWithCredentials and AjaxWithCredentials.
The static DefaultImgCrossOrigin is used to set the ImgCrossOrigin instance property for each new ImageLoader. The ImageLoader's ImgCrossOrigin value is the actual value used in setting the HTMLImageElement.crossOrigin
property for the WorkingImageElement.
Use the below table to understand the basic differences between these values and how they effect the resulting image. Note that these topics and implementations are from the HTML standard, not LEADTOOLS.
Value | Send Credentials | Will The Image Be Tainted? | Required Server Properties |
---|---|---|---|
null (default for HTMLImageElement) |
Yes | Yes | No Required Server Properties. |
'use-credentials' |
Yes | No |
The |
'anonymous' (or any other string) (default for ImageLoader) |
No | No |
The |
The default value used by ImageLoader is 'anonymous' to guarantee that the result image is not tainted so that image processing (such as interpolation) can occur on the image.
For more information on CORS, refer to Cross-Origin Resource Sharing (MDN), CORS enabled image (MDN), and CORS settings attributes (MDN).