简体   繁体   中英

django-dajaxice overriding XMLHttpRequest

We are using Django 1.4 with django-dajaxice. I recently found out that django-dajaxice overrides the default XMLHttpRequest object [ http://django-dajaxice.readthedocs.org/en/latest/ ]. It's a problem since we want to use https://github.com/tadruj/s3upload-coffee-javascript and it calls the method overrideMimeType of the object XMLHttpRequest(), which is undefined. I would like to know if it's possible to use django-dajaxice without overriding the default XMLHttpRequest class, or do we have not to use django-dajaxice at all? I think it's strange that a JavaScript plugin overrides a default object such as XMLHttpRequest.

I found a solution - look here: https://github.com/jorgebastida/django-dajaxice/blob/master/dajaxice/templates/dajaxice/dajaxice.core.js There is a variable DAJAXICE_XMLHTTPREQUEST_JS_IMPORT . If we set it to False in settings then django-dajaxice will not override XMLHttpRequest.

DAJAXICE_XMLHTTPREQUEST_JS_IMPORT = False

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM