使用带有CSS背景图像的CORS标头 [英] Using CORS headers with CSS background-image

查看:41
本文介绍了使用带有CSS背景图像的CORS标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简而言之:是否可以通过CSS中的 background-image 属性对图像进行跨源请求。我需要img标签的 crossOrigin 属性,但是在CSS中。

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.

我遇到了问题因为chrome缓存了没有CORS标头的响应,然后稍后,当< img> 标记使用相同的来源时,我收到了跨域错误,因为它使用的是缓存的没有必要的CORS标头的响应。

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.

推荐答案

检查此API。我猜您需要配置请求以使标头绕过缓存响应。

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

这篇关于使用带有CSS背景图像的CORS标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆