jQuery: The Write Less, Do More JavaScript Library

Changeset 5586

Show
Ignore:
Timestamp:
05/13/08 19:47:39 (3 months ago)
Author:
aflesler
Message:

jquery ajax: absolute urls were assumed to be cross domain. Closes #2816.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/ajax.js

    r5577 r5586  
    236236        // If we're requesting a remote document 
    237237        // and trying to load JSON or Script with a GET 
    238         if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && s.dataType == "script" && s.type.toLowerCase() == "get" ) { 
     238        if ( s.dataType == "script" && s.type.toLowerCase() == "get" 
     239                && jQuery.ajax.re.test(s.url) && jQuery.ajax.re.exec(s.url)[1] != location.host ){ 
    239240            var head = document.getElementsByTagName("head")[0]; 
    240241            var script = document.createElement("script"); 
     
    500501 
    501502}); 
     503 
     504// Matches an absolute URL, and saves the domain 
     505jQuery.ajax.re = /^(?:\w+:)?\/\/([^\/?#]+)/;