Draft
This page is not complete.
The XMLHttpRequest.overrideMimeType() method overrides the MIME type returned by the server. This may be used, for example, to force a stream to be treated and parsed as text/xml, even if the server does not report it as such. This method must be called before send()
.
void overrideMimeType(DOMString mimetype);
// Needs content
mimetype - a string of the file type
Nothing. It doesn't return anyhing.
// if the server doesn't specify, the returned text gets treated like xml // and when you receive plain text or something instead of xml // you get an error: XML Parsing Error: not well-formed // this shows how to receive plain text req = new XMLHttpRequest() req.overrideMimeType("text/plain") req.addEventListener("load", callback) req.open("get", url) req.send()
Specification | Status | Comment |
---|---|---|
XMLHttpRequest The definition of 'overrideMimeType()' in that specification. | Living Standard | WHATWG living standard |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 1 | ? | 5[1] 7 | (Yes) | 1.2 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | ? | 1.0 | (Yes) | ? | ? | ? |
[1] This feature was implemented via ActiveXObject(). Internet Explorer implements the standard XMLHttpRequest since version 7.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/overrideMimeType