Ticket #8212 (closed bug: worksforme)
Attach script load/readystatechange before script.src in cross-site ajax request
| Reported by: | dmethvin | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | ajax | Version: | 1.5 |
| Keywords: | needsreview | Cc: | jaubourg |
| Blocking: | Blocked by: |
Description
IE can sometimes fire ready right after script.src is set if the file is in cache. Just need to move the set below the attach of the handlers.
http://www.thefutureoftheweb.com/blog/image-onload-isnt-being-called
https://github.com/jquery/jquery/blob/master/src/ajax/script.js#L51
Change History
comment:1 Changed 2 years ago by jitter
- Cc jaubourg added
- Priority changed from undecided to low
- Component changed from unfiled to ajax
comment:3 Changed 2 years ago by jaubourg
While I would understand the behaviour for Image, I seriously doubt this would apply to script tags seeing as they're not loaded before the tag is injected into the document afaik. I may be wrong but I never ran into the problem before. Do you have tests to back this up, Dave?
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This sounds interesting but needs extensive testing across all supported browsers (which with this caching issues is a pain) as, judging by the comments on the blog post, this may not be fool proof and could start failing in other browsers other randomly.