jquery.fileDownload
jquery.fileDownload copied to clipboard
CSRF protection return 403 because of removing other cookies
there is django csrf protection on calling filedownload post data that return csrf failed https://docs.djangoproject.com/en/1.9/ref/csrf/
i dont use django but certainly let me know if you find a solution and/or make a PR
For Django CSRF token protection fileDownload need add csrftoken parameter currently, you just need add correct csrf value to do it
Example:
$.fileDownload(url, {
httpMethod: "POST",
csrfmiddlewaretoken: "{{csrf_token}}",
parameter: your_paramter,
})
There's a problem with iPad and django (1.11.6) on POST requests.
It seems Safari is not setting/sending the document.referrer, so the CsrfViewMiddleware will reject the request with error 403 because it suspects about a man-in-the-middle attack.
fileDownload when dealing with isIos devices opens a new window.