-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xhr.upload is undefined #46
Comments
I removed the entire dajaxice.core.js file and produced my own using just a few lines of code which is based on jquery. |
How are you getting this xhr object in dajaxice? call doesn't return its XMLHTTPRequest at any rate. |
This should fix bugs jorgebastida#46 and jorgebastida#47
I'm not retreiving the XHR object "from" dajaxice. I'm using javascript to access the native browser XHR. (javascript: new XMLHttpRequest) I beleive dajaxice prototypes the native XHR object, and in this process some of the features of the native XHR object gets lost. new XMLHttpRequest().upload ? true :false You will see that this will result in FALSE which is not correct in a modern browser. (try the same code in a console on this page and you will get TRUE). Sorry if my explanations are hard to read :-) I can make some screenies if its still unclear. |
It seems to me that this is mainly not dajaxice's problem (though it's using an old version of XMLHttpRequest.js which is not good) but https://github.com/ilinsky/xmlhttprequest which doesn't seem to set upload at all. It seems to me the main thing is that dajaxice replaces your browser's XMLHttpRequest with a cross-browser-compatible alternative. |
FWIW if you want to check this, try new XMLHttpRequest()._object.upload ? true :false. It should handle with the underlying browser-specific XMLHttpRequest object. Not a production-quality solution, just a note. |
quote: "It seems to me the main thing is that dajaxice replaces your browser's XMLHttpRequest with a cross-browser-compatible alternative." Yepp that is it. However I think that a proprietary crossbrowser XHR object is no longer needed as badly as before and could be skipped. As was what I did. Removed the entire dajaxice.js file and replaced with a few lines of jquery. Why not make dajaxice (js) dependent on JQuery and use JQuery ajax and also JQuery's JSON parser. (I've had several issues with the json parser aswell). Just a thought.. :-) |
Well, FWIW I'm not the maintainer... Also that is not a proprietary XHR object. It is LGPL. Using jQuery would most likely be completely overkill for this kind of simple stuff. As said, if you know you're dealing with modern browsers, just disable that variable I mentioned before. Not using the compat XHR might make dajaxice less compatible with old browsers. (I wasn't able to find references to how widely XMLHttpRequestUpload is supported) |
You can disable the import using DAJAXICE_XMLHTTPREQUEST_JS_IMPORT = False. |
I'm currently developing a file-upload javascript module, and I think that dajaxice somehow is messing things up.
In a fresh console on firefox/chrome i can write:
new XMLHttpRequest().upload ? true :false
which will respond with "true" in the console (requires modern browser)
If i do the same in my django project with dajaxice, I get false
I'm suspecting that the xmlHttpRequst object get's manipulated within dajaxice.
This is unfortunate as xhr.upload gives the means to track progress of a file-stream.
The text was updated successfully, but these errors were encountered: