Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if XMLHttpRequest's send() supports File

Safari's XMLHttpRequest's send() method supports a File argument. Firefox does not (yet).

How can I check if this is supported? In Firefox, it will just behave as if an empty string was passed.

I'm trying to avoid doing browser version detection.

Edit: FF 3.6 does seem to support it, but the question is still relevant for older versions or other browsers.

like image 832
Jaka Jančar Avatar asked Mar 11 '10 21:03

Jaka Jančar


People also ask

How do I check XMLHttpRequest status?

status property returns the numerical HTTP status code of the XMLHttpRequest 's response. Before the request completes, the value of status is 0. Browsers also report a status of 0 in case of XMLHttpRequest errors.

What are the types of send () method used for XMLHttpRequest?

The XMLHttpRequest method send() sends the request to the server. If the request is asynchronous (which is the default), this method returns as soon as the request is sent and the result is delivered using events.


1 Answers

It's possible that if the File object can be created, than send supports it. In Gecko (firefox,) that will be true (File and the send's File compatibility were both released in 1.9 according to MDC)

like image 105
robert Avatar answered Sep 19 '22 15:09

robert