如何将 crossorigin='anonymous' 从 js 添加到脚本

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);
            }

如您所见,我在其中设置 crossorigin,但结果是当我看到 html 时,脚本没有 crossorigin。基本上,我不想得到 opaque 响应,那么如何正确设置 crossorigin

错误的属性名称。它是 crossOrigin 驼峰式