Sha256: 549861017450eb8d9cd7a40d56df143af7d651024a0d67e6e887e17e464cc501

Contents?: true

Size: 858 Bytes

Versions: 4

Compression:

Stored size: 858 Bytes

Contents

/*global define*/
define(function() {
    "use strict";

    var a;

    /**
     * Given a URL, determine whether that URL is considered cross-origin to the current page.
     *
     * @private
     */
    var isCrossOriginUrl = function(url) {
        if (typeof a === 'undefined') {
            a = document.createElement('a');
        }

        // copy window location into the anchor to get consistent results
        // when the port is default for the protocol (e.g. 80 for HTTP)
        a.href = window.location.href;

        // host includes both hostname and port if the port is not standard
        var host = a.host;
        var protocol = a.protocol;

        a.href = url;
        a.href = a.href; // IE only absolutizes href on get, not set

        return protocol !== a.protocol || host !== a.host;
    };

    return isCrossOriginUrl;
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cesium-0.19.0 app/assets/javascripts/Core/isCrossOriginUrl.js
cesium-0.18.0 app/assets/javascripts/Core/isCrossOriginUrl.js
cesium-0.17.0 app/assets/javascripts/Core/isCrossOriginUrl.js
cesium-0.16.0 app/assets/javascripts/Core/isCrossOriginUrl.js