ajax: script: Threat sameDomain file:// requests as crossDomain
[jquery.git] / src / ajax / script.js
index 731f5b6..764a806 100644 (file)
@@ -30,11 +30,14 @@ jQuery.ajaxPrefilter( "script", function( s ) {
 // Bind script tag hack transport
 jQuery.ajaxTransport( "script", function(s) {
 
-       // This transport only deals with cross domain requests
-       if ( s.crossDomain ) {
+       // This transport primarily deals with cross domain requests
+       // but also sameDomain request within file:// due to
+       // http://code.google.com/p/chromium/issues/detail?id=4197 + 47416
+       var local = location.protocol === 'file:';
+       if ( s.crossDomain || local ) {
 
                var script,
-                       head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;
+                       head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
 
                return {