Issue with opening share url in a new tab
See original GitHub issueLink example http://radiko.jp/share/?t=20210329153524&sid=JORF
On Edge 89.0.774.63, (sometimes?) it will stuck in a loop (share -> radio page -> radiko out -> share -> radio page -> radiko out …) On Brave 1.22.70, it will navigate back to the empty new tab
I guess it’s related to the recent change and somehow each browsers dealt with it differently.
if (window.location.hash == "#!/out"){
$.colorbox.close();
history.back()
}
Idea : Instead of relying on location hash, is it possible to deal with this directly?
area.js
$.Radiko.ajax('/area', function (data, status, xhr) {
/* snipped */
var areaFreeId = $.cookie('areafree_id');
if (typeof areaFreeId !== 'undefined') {
$.Radiko.area.id = areaFreeId;
}
else {
$.Radiko.area.id = defaultAreaId;
}
$.Radiko.header.create_header(getAreaId(), loginStatus);
}, function () {
$.Radiko.area.id = 'OUT'; //<---------
}, 'text', true).always(function () {
if ($.Radiko.area.id === 'OUT') {
window.location.hash = '#!/out';
}
$.Radiko.EventEmitter.trigger('radikoready');
});
The extension blocking ajax call to /area which make them to assign the default value of $.Radiko.area.id to “OUT”. This seems to be the ultimate final check that causing user to be redirected to #!/out .
Override $.Radiko.area.id to any value (or to the relevant value from cookie) after they assign “OUT”, and user will get a proper web page.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Finally . I decide to hijack jquery.ajax to make
$.Radiko.area.check_area
's error function not work and set a $.Radiko.area.id to bypassOUT
issue.Dirty work. Dirty code. but make sense.
Thanks for your test.
I might found the key to the problem.
OUT
OUT
if (location.hash !== “”) { Path.dispatch(location.hash); }origin
origin
and step 2 and ( 3 + 4 ) order is not guaranteed. so if 3+4 before 2 then it will go to right origin url then go to
OUT
So the only way is to add some delay. 😞