Skip to content

Commit

Permalink
[Chromium] Fix YouTube navigation
Browse files Browse the repository at this point in the history
Fix back/forward navigation from YouTube pages by marking mobile URLs of
YouTube as skippable so that only desktop URLs are used in navigation.
  • Loading branch information
zakharvoit committed Feb 29, 2024
1 parent 18e8e80 commit 4bc8554
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.WebContents;
import org.chromium.url.GURL;
import org.chromium.wolvic.Tab;
import org.chromium.wolvic.WolvicWebContentsDelegate;

public class TabWebContentsDelegate extends WolvicWebContentsDelegate {
Expand Down Expand Up @@ -110,6 +111,10 @@ public void onUpdateUrl(GURL url) {
// If mobile Youtube URL is detected, redirect to the desktop version.
if (!url.getSpec().equals(newUrl)) {
LoadUrlParams params = new LoadUrlParams(newUrl);
mWebContents.getNavigationController().setEntryExtraData(
mWebContents.getNavigationController().getLastCommittedEntryIndex(),
Tab.NAVIGATION_ENTRY_MARKED_AS_SKIPPED_KEY,
Tab.NAVIGATION_ENTRY_MARKED_AS_SKIPPED_VALUE);
mWebContents.getNavigationController().loadUrl(params);
return;
}
Expand Down

0 comments on commit 4bc8554

Please sign in to comment.