msCaching property
Specifies whether stream data downloaded using XMLHttpRequest is cached to disk or not.
This property is read/write.
Syntax
JavaScript |
---|
object.msCaching = cacheState cacheState = object.msCaching |
Property values
Type: DOMString
Value | Condition |
---|---|
auto | Disables caching for stream or ms-stream data. |
enabled | Enables caching for stream or ms-stream data. |
disabled | Disables caching for any data. |
Remarks
By not caching data streamed using XHR, you can get better battery life on tablets and laptops, and avoid disk latency bottlenecks. To get the current caching state, use msCachingEnabled.
Examples
This example shows how to force caching for a stream of data.
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.msCaching = 'enabled';
xhr.responseType = 'stream';
xhr.send();