Using CORS headers with CSS background-image

有些话、适合烂在心里 提交于 2020-04-07 18:22:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!