lib/requester/browser/request.js
// Return whether a URL is a cross-domain request.
Return whether a URL is a cross-domain request.
Return whether a URL is a cross - domain request .
function is_crossDomain(url) {
    var rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/
    var ajaxLocation
    try { ajaxLocation = location.href }
    catch (e) {
        ajaxLocation = document.createElement( "a" );
        ajaxLocation.href = "";
        ajaxLocation = ajaxLocation.href;
    }
    var ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []
        , parts = rurl.exec(url.toLowerCase() )
    var result = !!(
        parts &&
        (  parts[1] != ajaxLocParts[1]
            || parts[2] != ajaxLocParts[2]
            || (parts[3] || (parts[1] === "http:" ? 80 : 443)) != (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? 80 : 443))
        )
    )
    return result
}
function is_crossDomain ( url ) { var rurl = / ^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)? / var ajaxLocation try { ajaxLocation = location . href } catch ( e ) { ajaxLocation = document . createElement ( "a" ) ; ajaxLocation . href = "" ; ajaxLocation = ajaxLocation . href ; } var ajaxLocParts = rurl . exec ( ajaxLocation . toLowerCase ( ) ) || [ ] , parts = rurl . exec ( url . toLowerCase ( ) ) var result = ! ! ( parts && ( parts [ 1 ] != ajaxLocParts [ 1 ] || parts [ 2 ] != ajaxLocParts [ 2 ] || ( parts [ 3 ] || ( parts [ 1 ] === "http:" ? 80 : 443 ) ) != ( ajaxLocParts [ 3 ] || ( ajaxLocParts [ 1 ] === "http:" ? 80 : 443 ) ) ) ) return result }
Return whether a URL is a cross-domain request.
Return whether a URL is a cross - domain request .
// jQuery #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set // Use the href attribute of an A element since IE will modify it given document.location //console.debug('is_crossDomain('+url+') -> ' + result)