Comments (8)
I removed the entire dajaxice.core.js file and produced my own using just a few lines of code which is based on jquery.
I suggest this to be a much more stable and lightweight way...
from django-dajaxice.
How are you getting this xhr object in dajaxice? call doesn't return its XMLHTTPRequest at any rate.
from django-dajaxice.
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.
If you have firefox/chrome, open a webpage that uses dajaxice and paste into the browser console:
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.
from django-dajaxice.
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.
from django-dajaxice.
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.
I think a better workaround is to make sure DAJAXICE_XMLHTTPREQUEST_JS_IMPORT is false when generating dajaxice.core.js. This will prevent XMLHttpRequest from being replaced.
from django-dajaxice.
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.. :-)
from django-dajaxice.
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)
from django-dajaxice.
You can disable the import using DAJAXICE_XMLHTTPREQUEST_JS_IMPORT = False.
from django-dajaxice.
Related Issues (20)
- No error reporting when DEBUG=False
- Dajaxice generated url does not take WSGIScriptAlias into account HOT 1
- Forked and maintained django-dajaxice HOT 1
- DeprecationWarning HOT 1
- Running a django project in a folder
- Pull request #75 /issue #69 back in version 0.6
- Dajaxice only registers one function
- Is there a way to split ajax.py into a few smaller files? HOT 2
- error after django 1.7 upgrade: __init__() got an unexpected keyword argument 'mimetype' HOT 1
- XMLHttpRequest emits onreadystatechange but not onload event HOT 1
- content-type application/octet-stream Problem if nosniff active on webserver
- Incompatibility with django-debug-toolbar
- Unable to find dajaxice/dajaxice.core.js under Windows.
- RemovedInDjango19Warning
- Django server in one computer, client in other computer Problem
- "No module named 'Dajaxice'" with python 3
- dajaxice.core.js:606 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
- Modify GitHub blurb
- safe_dict(d) has same error as old dajaxice project
- Error in new version of Django in urlpatterns
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-dajaxice.