crossorigin

crossorigin 属性,适用于 <image><feImage> 元素,支持对元素获取的数据进行跨域资源共享 (CORS) 请求的配置。

下表显示了可能的关键字及其含义

关键字 描述
anonymous 此元素的客户端 CORS 请求会将凭证标志设置为 'same-origin'。
use-credentials 此元素的客户端 CORS 请求会将凭证标志设置为 'include'。
"" 将属性名设置为一个空值,例如 crossorigincrossorigin="",与 anonymous 相同。

它遵循与 HTML 属性 crossorigin 相同的处理规则。

示例

html
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
  <image
    href="https://example.com/mdn_logo_dark.png"
    height="200"
    width="200"
    crossorigin="use-credentials" />
</svg>

规范

规范
滤镜效果模块第 1 级
# element-attrdef-feimage-crossorigin
Scalable Vector Graphics (SVG) 2
# ImageElementCrossoriginAttribute

浏览器兼容性

svg.elements.feImage.crossorigin

svg.elements.image.crossorigin

另见