You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Until now, the AJAX script transport only used a script tag to load scripts
for cross-domain requests or ones with scriptAttrs set. This commit makes
it also used for all async requests to avoid CSP errors arising from usage
of inline scripts. This also makes jQuery.getScript not trigger CSP errors
as it uses the AJAX script transport under the hood.
For sync requests such a change is impossible and that's what jQuery._evalUrl
uses. Fixing that is tracked in gh-1895.
The commit also makes other type of requests using the script tag version of the
script transport set its type to "GET", namely async scripts & ones with scriptAttrs set in addition to the existing cross-domain ones.
The reason will be displayed to describe this comment to others. Learn more.
One thing we do lose here is the ability to set XHR stuff like headers on a script request. I would definitely consider that a breaking change but since it's set for 4.0 it's fair game. At the moment though, there doesn't seem to be an easy way to get the old behavior back and use the old transport.
Until now, the AJAX script transport only used a script tag to load scripts
for cross-domain requests or ones with `scriptAttrs` set. This commit makes
it also used for all async requests to avoid CSP errors arising from usage
of inline scripts. This also makes `jQuery.getScript` not trigger CSP errors
as it uses the AJAX script transport under the hood.
For sync requests such a change is impossible and that's what `jQuery._evalUrl`
uses. Fixing that is tracked in jquerygh-1895.
The commit also makes other type of requests using the script tag version of the
script transport set its type to "GET", namely async scripts & ones with
`scriptAttrs` set in addition to the existing cross-domain ones.
Fixesjquerygh-3969
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Until now, the AJAX script transport only used a script tag to load scripts
for cross-domain requests or ones with
scriptAttrs
set. This commit makesit also used for all async requests to avoid CSP errors arising from usage
of inline scripts. This also makes
jQuery.getScript
not trigger CSP errorsas it uses the AJAX script transport under the hood.
For sync requests such a change is impossible and that's what
jQuery._evalUrl
uses. Fixing that is tracked in gh-1895.
The commit also makes other type of requests using the script tag version of the
script transport set its type to "GET", namely async scripts & ones with
scriptAttrs
set in addition to the existing cross-domain ones.Fixes gh-3969
Checklist
If needed, a docs issue/PR was created at https://github.com/jquery/api.jquery.com