Why can't my XMLHttpRequest download pictures across domains?

it is possible to use XMLHttpRequest to download pictures in static web pages. Pictures can be opened normally, but
put the web pages on the server and download them in a cross-domain way.
configured cross-domain, also used Access-Control-Expose-Headers to output some header, can be downloaded to the picture, but the downloaded picture is nearly twice the size of the original, and can not be opened, which god came out to save me, three hours did not sleep.
background code is as follows:

clipboard.png
:

clipboard.png

:

clipboard.png

js :

clipboard.png

content-length content-disposition content-typeheader
debugcontent-lengthKBlob

clipboard.png


spring4 and later, add @ CorsOrigin annotation to the interface you want to access, allowing the interface to be accessed across domains. If it is before, write your own filter global Filter request header information, and use your own Google

.
Menu