Opened 12 years ago
Closed 12 years ago
#7134 closed bug (wontfix)
script tags seem not to load when site is in another domain
Reported by: | Jason R. Coombs | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | unfiled | Version: | 1.1.4 |
Keywords: | jsonp | Cc: | |
Blocked by: | Blocking: |
Description
From what I understand, one cannot use XmlHttpRequest (and thus .ajax) for cross-site script requests (for security reasons), but one can use <script> tags and jsonp.
With 1.1.4, however, it appears as if jQuery silently ignores <script> tags that reference scripts in another domain. I've created a simple example html file.
<html> <head> <script src="jquery-1.1.4.js" type="text/javascript"> </script> <script type="text/javascript"> var url = 'http://dl.dropbox.com/u/54081/simplealert.js' $('head').append('<script src="' + url + '">') </script> </head> </html>
You can view simplealert.js, but all it does is make a javascript alert
call, so one can tell if it was called or not.
Executing the above HTML results in no alert called (the javascript isn't requested). If, however, one uses 1.1.3.1 instead, the request completes as expected.
If I understand correctly, this means it is not possible to implement JSONP in jQuery 1.1.4.
There's no mention of this behavior change in the release notes, and there are no longer any tickets under bugs closed for 1.1.4.
Is this limitation by design? I understand this may be closed as won't fix, but I wanted to be sure to capture the issue so it's documented somewhere.
1.1.4 is ancient and not supported. Upgrade.