Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Fix inactive forward button for videos on youtube.com #1463

Merged
merged 1 commit into from
Jul 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/src/main/assets/web_extensions/webcompat_youtube/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ try {
}

const newUrl = getNewUrl(qs);
if (newUrl && window.location.pathname + window.location.search !== newUrl) {
if (newUrl && (window.location.pathname + window.location.search) !== newUrl) {
window.history.replaceState({}, document.title, newUrl);
return newUrl;
}
Expand Down Expand Up @@ -289,6 +289,16 @@ try {
window.ytplayer.config.args.jsapicallback = 'onYouTubePlayerReady';
}
});

window.addEventListener("beforeunload", function (e) {
// Make sure that the disable_polymer parameter is kept. Youtube processes the parameter but removes it from the URL.
// See https://github.com/MozillaReality/FirefoxReality/issues/1426
let qs = new URLSearchParams(window.location.search);
qs.set('disable_polymer', '1');
let url = getNewUrl(qs);
window.history.replaceState({}, document.title, url);
});

} catch (err) {
console.error(LOGTAG, 'Encountered error:', err);
}