Creates a URL for the specified object.
Method of apis/file/URLapis/file/URL
var objectURL = URL.createObjectURL(object, options);
The object that needs a URL. Usually a File.
- DOM Node
A dictionary object. See ObjectURLOptions for more information. Used with oneTimeOnly attribute to create a single use URL that does not need to be revoked.
Returns an object of type StringString
A URL for the specified object.
Displaying an image based on the selected file in a
var url = URL.createObjectURL(inputElement.files); imgElement.src = url;
The URL that is created can be used for resources for use with elements such as Image, video, and audio. The object passed in through object is stored in an internal hash table. oOptions is set when you want to only use the URL once. The ObjectURLOptions object has one property, oneTimeOnly, that is set to false by default. To set the URL for the object (blob, stream, and so forth) to single use, use the ObjectURLOptions object and set oneTimeOnly to true. To revoke a URL created with createObjectURL, use revokeObjectURL.
- W3C File API Specification
- W3C Working Draft
Microsoft Developer Network: Windows Internet Explorer API reference Article