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().


XMLHttpRequest.overrideMimeType(DOMString mimetype)


mimetype - a string of the file type

Return value

Nothing. It doesn't return anything.


// 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.addEventListener("load", callback)
req.open("get", url)


Specification Status Comment
The definition of 'overrideMimeType()' in that specification.
Living Standard WHATWG living standard

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1 (Yes) ? 5[1]
(Yes) 1.2
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 1.0 (Yes) (Yes) ? ? ?

[1] This feature was implemented via ActiveXObject(). Internet Explorer implements the standard XMLHttpRequest since version 7.

See also

Document Tags and Contributors

 Contributors to this page: Makyen, erikadoyle, buzzdecafe, cong, jsx, MashKao
 Last updated by: Makyen,