diff --git a/src/js/utils/url.js b/src/js/utils/url.js index 653f581574..6532c28fe4 100644 --- a/src/js/utils/url.js +++ b/src/js/utils/url.js @@ -105,8 +105,8 @@ export const getFileExtension = function(path) { * @method isCrossOrigin */ export const isCrossOrigin = function(url) { - let urlInfo = parseUrl(url); let winLoc = window.location; + let urlInfo = parseUrl(url); // IE8 protocol relative urls will return ':' for protocol let srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol; diff --git a/test/unit/utils/url.test.js b/test/unit/utils/url.test.js index 79d9ab7a7a..4e2ed9aba7 100644 --- a/test/unit/utils/url.test.js +++ b/test/unit/utils/url.test.js @@ -93,7 +93,6 @@ test('isCrossOrigin can identify cross origin urls', function() { win.location.protocol = 'https:'; win.location.host = 'google.com'; ok(Url.isCrossOrigin('http://google.com/example.vtt'), 'http://google.com from https://google.com is cross origin'); - ok(Url.isCrossOrigin('//google.com/example.vtt'), '//google.com from https://google.com is cross origin'); ok(Url.isCrossOrigin('http://example.com/example.vtt'), 'http://example.com from https://google.com is cross origin'); ok(Url.isCrossOrigin('https://example.com/example.vtt'), 'https://example.com from https://google.com is cross origin'); ok(Url.isCrossOrigin('//example.com/example.vtt'), '//example.com from https://google.com is cross origin');