Snippets add import jQuery CORS
let script = document.createElement('script');
script.src="https://code.jquery.com/jquery-3.2.1.min.js";
script.integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=";
script.crossorigin="anonymous";
document.head.appendChild(script);
error:
Subresource Integrity: The resource 'https://code.jquery.com/jquery-3.2.1.min.js' has an integrity attribute, but the resource requires the request to be CORS enabled to check the integrity, and it is not. The resource has been blocked because the integrity cannot be enforced.
2022-11-07
我嘗試了一下,去掉integrity和crossorigin屬性,就不再報CORS了...
如下: