[英]how to add crossorigin='anonymous' from js to script
script.type = 'text/javascript';
script.async = true;
script.src = url;
script.crossorigin="anonymous"
const element = document.getElementsByTagName('script')[0];
element.parentNode.insertBefore(script, element);
script.onload = () => {
resolve(script);
}
As you can see, I am setting crossorigin
in there, but it turns out that when I see the html
, script doesn't have crossorigin
.如您所见,我在那里设置
crossorigin
,但事实证明,当我看到html
时,脚本没有crossorigin
。 Basically, I don't want to have opaque
response, so how do I set crossorigin
correctly?基本上,我不想有
opaque
的响应,那么如何正确设置crossorigin
呢?
Wrong attribute name.错误的属性名称。 It's
crossOrigin
in camelCase在 camelCase 中是
crossOrigin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.