From c2bfe489eab2c6f39335f0ede5a942bdefec11c9 Mon Sep 17 00:00:00 2001 From: Andre Gagnon Date: Tue, 24 Aug 2021 08:16:30 -0500 Subject: [PATCH] Let icons load in iframes without a location (#2259) Currently, icons will fail to load if the player is placed inside an iframe without a window.location. This adds an additional check to use `window.top.location` if the window does not have a location. --- src/js/controls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/controls.js b/src/js/controls.js index ff20982e..9fe74272 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -38,7 +38,8 @@ const controls = { // Get icon URL getIconUrl() { const url = new URL(this.config.iconUrl, window.location); - const cors = url.host !== window.location.host || (browser.isIE && !window.svg4everybody); + const host = window.location.host ? window.location.host : window.top.location.host; + const cors = url.host !== host || (browser.isIE && !window.svg4everybody); return { url: this.config.iconUrl,