Skip to content

Commit

Permalink
Safari would not handle frame accesses when using the legacy(?) `fram…
Browse files Browse the repository at this point in the history
…es` object, instead of `document`.

Signed-off-by: Michael Herger <michael@herger.net>
  • Loading branch information
michaelherger committed Feb 8, 2025
1 parent ec548d4 commit 55c145f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
9 changes: 5 additions & 4 deletions HTML/Default/html/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ Main = {
playerobj = SqueezeJS.getPlayer();

// set the browser frame to use the selected player
if (frames.browser && frames.browser.location && frames.browser.location.protocol.match(/^http/)) {
frames.browser.location = SqueezeJS.Utils.replacePlayerIDinUrl(frames.browser.location, playerobj);
const location = frames.browser && frames.browser.location || document.browser.location;
if (location.protocol.match(/^http/)) {
SqueezeJS.Utils.setBrowseLocation(SqueezeJS.Utils.replacePlayerIDinUrl(location, playerobj));
}

// make the settings link use the new player ID
Expand Down Expand Up @@ -424,8 +425,8 @@ Main = {
tooltip: SqueezeJS.string('save'),
minWidth: 32,
noText: true,
handler: function(){
frames.browser.location = webroot + 'edit_playlist.html?player=' + SqueezeJS.Controller.getPlayer() + '&saveCurrentPlaylist=1';
handler: function() {
SqueezeJS.Utils.setBrowseLocation(webroot + 'edit_playlist.html?player=' + SqueezeJS.Controller.getPlayer() + '&saveCurrentPlaylist=1');
}
});

Expand Down
5 changes: 1 addition & 4 deletions HTML/Default/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@
}
}

if (frames.browser.location)
frames.browser.location.href = navigationUrl;
else if (document.browser.location)
document.browser.location.href = navigationUrl;
SqueezeJS.Utils.setBrowseLocation(navigationUrl);

if (Ext.ux.Lightbox) {
Ext.ux.Lightbox.labelOf = '[% "OF" | string %]';
Expand Down
9 changes: 8 additions & 1 deletion HTML/EN/html/SqueezeJS/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ SqueezeJS.SonginfoParser = {

SqueezeJS.Utils = {
replacePlayerIDinUrl : function(url, id){
if (!id)
if (!id || !url)
return url;

if (typeof url == 'object' && url.search != null) {
Expand Down Expand Up @@ -898,6 +898,13 @@ SqueezeJS.Utils = {
});

return parts;
},

setBrowseLocation: function(url) {
if (frames.browser.location)
frames.browser.location.href = url;
else if (document.browser.location)
document.browser.location.replace(url);
}
};

Expand Down

0 comments on commit 55c145f

Please sign in to comment.