#8166 closed bug (wontfix)
$.getScript: sameDomain file:// requests fails in Chromium when using XHR
Reported by: | Owned by: | jaubourg | |
---|---|---|---|
Priority: | low | Milestone: | 1.5.1 |
Component: | ajax | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When doing same-domain file:// XHR Chromium spits out an
XMLHttpRequest cannot load file://[...].js. Origin null is not allowed by Access-Control-Allow-Origin.
The following patch is pullable from: git://git.asbjorn.biz/jquery.git getscript-fix
ajax: script: Threat sameDomain file:// requests as crossDomain Due to file:// XHR security measures in Chromium, dynamic loading of scripts need to use the script tag injection hack. Tested in Chromium 6.0.472.63, Firefox 3.6.7 and Konqueror 4.4.5 Signed-off-by: Asbjørn Sloth Tønnesen <ast@mugami.com>
-
src/ajax/script.js
diff --git a/src/ajax/script.js b/src/ajax/script.js index 34ddd04..c80696c 100644
a b jQuery.ajaxPrefilter( "script", function( s ) { 30 30 // Bind script tag hack transport 31 31 jQuery.ajaxTransport( "script", function(s) { 32 32 33 // This transport only deals with cross domain requests 34 if ( s.crossDomain ) { 33 // This transport primarily deals with cross domain requests 34 // but also sameDomain request within file:// due to 35 // http://code.google.com/p/chromium/issues/detail?id=4197 + 47416 36 var local = location.protocol === 'file:' 37 if ( s.crossDomain || local ) { 35 38 36 39 var script, 37 40 head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
Related issues in Chromiums issue tracker:
Change History (8)
comment:1 Changed 13 years ago by
Component: | unfiled → ajax |
---|---|
Priority: | undecided → high |
Resolution: | → duplicate |
Status: | new → closed |
comment:2 Changed 13 years ago by
comment:3 Changed 13 years ago by
Milestone: | 1.next → 1.5.1 |
---|---|
Version: | git → 1.5 |
comment:4 Changed 13 years ago by
This is not a duplicate of #8125, that was fixed in git two days ago, my bug report was against git, not 1.5.
Testcases based on current git HEAD and HEAD+fix: http://asbjorn.it/pub/bugreports/jquery/6166-testcase.tar.bz2 to be run from local file:// context.
BTW: The patch had a minor error which has been fixed in git://git.asbjorn.biz/jquery.git getscript-fix
comment:5 Changed 13 years ago by
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
comment:6 Changed 13 years ago by
Owner: | set to jaubourg |
---|---|
Status: | reopened → assigned |
comment:7 Changed 13 years ago by
Priority: | high → low |
---|---|
Resolution: | → wontfix |
Status: | assigned → closed |
If you wanna make sure every script requests are considered cross-domain, add the following prefilter:
jQuery.ajaxPrefilter( "script", function( s ) { s.crossDomain = true; } );
Note: See
TracTickets for help on using
tickets.
Duplicate of #8125.