-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Closed
Labels
Milestone
Description
var s = document.createElement('script')
s.src = 'data:,console.log(1)'
document.body.appendChild(s)
// output 1but if insert this script by jQuery: $('body').append(s), it will be get an error.
this is due to jQuery execute script by ajax of script[src],
and jQuery will append extra query params _=xxxx to prevent script cache by default.
https://github.com/jquery/jquery/blob/2.1.1/src/manipulation/_evalUrl.js#L9
fix this is simple, just set cache=true… may i pull a PR for this?
by the way, anyone knows why jQuery set async=false for inserted scripts?
this is inconsistent with browser's default behavior