File: Loader.md | Updated: 11/15/2025
Abstract base class for loaders.
Constructs a new loader.
manager | The loading manager.
---|---
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
Default is 'anonymous'.
The loading manager.
Default is DefaultLoadingManager.
The base path from which the asset will be loaded.
The request header used in HTTP request.
The base path from which additional resources like textures will be loaded.
Whether the XMLHttpRequest uses credentials.
Default is false.
The default material name that is used by loaders when creating materials for loaded 3D objects.
Note: Not all loaders might honor this setting.
Default is '__DEFAULT'.
This method can be implemented in loaders for aborting ongoing requests.
Returns: A reference to this instance.
This method needs to be implemented by all concrete loaders. It holds the logic for loading assets from the backend.
url | The path/URL of the file to be loaded.
---|---
onLoad | Executed when the loading process has been finished.
onProgress | Executed while the loading is in progress.
onError | Executed when errors occur.
A async version of Loader#load.
url | The path/URL of the file to be loaded.
---|---
onProgress | Executed while the loading is in progress.
Returns: A Promise that resolves when the asset has been loaded.
This method needs to be implemented by all concrete loaders. It holds the logic for parsing the asset into three.js entities.
data | The data to parse.
---|---
Sets the crossOrigin String to implement CORS for loading the URL from a different domain that allows CORS.
crossOrigin | The crossOrigin value.
---|---
Returns: A reference to this instance.
Sets the base path for the asset.
path | The base path.
---|---
Returns: A reference to this instance.
Sets the given request header.
requestHeader | A request header for configuring the HTTP request.
---|---
Returns: A reference to this instance.
Sets the base path for dependent resources like textures.
resourcePath | The resource path.
---|---
Returns: A reference to this instance.
Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS client certificates, see XMLHttpRequest.withCredentials.
Note: This setting has no effect if you are loading files locally or from the same domain.
value | The withCredentials value.
---|---
Returns: A reference to this instance.