Support ajax script attributes (e.g. for SRI or CSP) #3028
Comments
|
We recently got a similar request for CSP nonces in #2612 but the submitter went dark. Rather than trying to support all these individually and then needing to verify they each work across all browsers, maybe we could just treat this like headers and give |
|
If my request wasn't clear, here is the exact scenario. We use
I'm relatively new to js, but no reason why I can't chip in. |
|
I'd prefer we just add options to $.ajax({
dataType: "script",
url: "https://some/path",
attrs: { nonce: "EDNnf03nceIOfn39fn3e9h3sdfa" },
});which would inject a tag like: <script nonce="EDNnf03nceIOfn39fn3e9h3sdfa" src="https://some/path">I suppose we could have |
|
|
|
@markelog Yes, unfortunately it's another transport-specific setting. It would be ignored by transports that didn't need it such as XHR. |
Fixes jquerygh-3028 Ref jquerygh-2612 Useful, for example, to add `nonce`, `integrity`, or `crossorigin`.
Fixes jquerygh-3028 Ref jquerygh-2612 Useful, for example, to add `nonce`, `integrity`, or `crossorigin`.
|
Based on the way the PR is implemented, if |
@razamirza mentioned here: jquery/codeorigin.jquery.com#20 (comment)
I think it would be worth considering adding support to check a script on the outside, however probably this is worthy of an extension until all browsers support fetch+SRI/WebCrypto natively.
The text was updated successfully, but these errors were encountered: