问题
Shortly: Is there any way to make a cross origin request for an image with the background-image
property in CSS. I need something like the crossOrigin
property for the img tag, but in CSS.
I am running into a problem because chrome caches the response without CORS headers, and then later, when an <img>
tag uses the same source I get a cross-origin error because it is using the cached response that doesn't have the necessary CORS headers.
回答1:
Check this API. I guess you need to configure your request to get the header to bypass the cache response..
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html
来源:https://stackoverflow.com/questions/21638606/using-cors-headers-with-css-background-image