What is the best method to detect xml in JavaScript
e.g. is it possible to detect the mime type of a document – particularly if it is text/xml in JavaScript.
this needs to work in Chrome.
thanks,
Josh
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using
XMLHttpRequestto get this data, then you can simply check for theContent-Typeheader using thegetResponseHeadermethod (granted that the server sends the appropriate headers).(I seem to be using this code sample a lot…)