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.
This commit is contained in:
Andre Gagnon 2021-08-24 08:16:30 -05:00 committed by GitHub
parent 882952bba6
commit c2bfe489ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

3
src/js/controls.js vendored
View File

@ -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,