-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hitting the back button on youtube videos doesn't work correctly #29432
Comments
+1 on this. Have seen it a few times on macOS as well but not always. |
I've experienced this as well |
Nonstop here as well. |
this needs to be resolved |
Same problem here but just to be more accurate: This seems to mostly happen or perhaps only happen from https://www.youtube.com/feed/subscriptions, displaying a video, then going back to the subscription page. |
I've experienced this too, was about to create a new issue but found this one. I'm not sure if this only happens when searching through the site, or if it's only when going directly to the search URL. I couldn't get it to happen when I went through the YouTube site to search, but if I went directly to the search URL, I had the issue. Not sure if it happens both ways or not. How I reproduced the bug: The weird thing is that it doesn't happen every time. It can be hard to reliably reproduce. Here's a video I recorded of my screen showing the link to search "ghost" working, the link to search "ghost 2" working, but when I search "ghost 3" and hit back, it doesn't work. Keep an eye on the URL and you'll see that the URL changes but not the webpage. I don't think the search query itself matters, this is just an example of quickly searching. Perhaps this has something to do with the page being fully loaded or not, and perhaps it's caused by the YouTube JavaScript on their page updating the page URL, rather than the browser itself? Not sure though! Bug is visible at 00:15. out.mp4I actually got this bug to happen on the Brave mobile app (Android), too. But I was only able to reproduce it when the YouTube was in "Desktop Site" mode. I wasn't able to reproduce on the mobile version. Note that the URL says "results" instead of "watch". results = search Because the video is partially loaded, this makes me think it has something to do with the way the page is initialized in Brave. |
I get this too: I am on Firefox Desktop browser. |
Very annoying but I've seen firefox users complaining about this as well. It's been happening for a year or so it seems. |
cc @rebron |
I'm seeing the same thing on GitHub's new code browser as well - history pops, but content does not change until refreshing the page. Can't repro on Chrome Stable. |
I am a Firefox user and posted a previous comment in this section. |
Same to me (using brave). |
@neilx11 are you having an issue in Brave? |
I made a change recently try Updating |
Thanks @ryanbr. I am using 1.0.348 and unfortunately still have the same bug. Looks like it happens in Private windows too. The way I test it is to go to Interestingly enough I can't get it to happen when you are already on the page and then search for "asdf" etc. It seems to happen when you go to the page directly. Although the bug may exist when the page is already loaded, I'm not sure, but I've had the most luck reproducing the bug by going to the page directly. Here's another demo... brave_CiFEd7O7Sh.mp4I'm using the back button on my mouse. It seems to work fine when using the search box inside the YouTube page, but when going to the URL directly, whether typing it in, using it as a search engine in Brave (typing "youtube asdf6"), or even clicking on a link from a search engine like Google/Brave/etc the bug will present itself. In the demo above, notice how around second 23 (changing the URL to asdf6) the screen flashes. That's when I press the back button. |
@ryanbr after updating to 1.0.348, I tried on each channel in a fresh profile and hit the issue exactly once per channel, on the first try, and then it never reproduced again. In my main profile, on the release channel, where I haven't restarted the browser, the update didn't seem to have an effect and the issue is still fully there. |
With shields up, no extensions. When hitting the back button what does it show in the console? |
All debugging levels turned on in console. When searching https://www.youtube.com/results?search_query=asdf20a on a new profile When searching https://www.youtube.com/results?search_query=asdf20b on a new profile... In my tests, I had the issue happen whether shields were up or not, on any profile, and have used |
Try adding @@/generate_204 into brave://adblock custom rules, save and reload YT. |
Same problem, but keep in mind even with shields down it does the same thing. |
Closed via brave/adblock-resources#131. |
"[closed/fixed-by-component-update]" It's not fixed at all. I still have the same problem. |
I guess this didn't hit production yet |
I personally haven't experienced the issue in a while. |
The changes were shipped via the component updater around September 13. |
For me is still happening as well, versions: Ad Block Resources Library - Version: 1.0.71 |
1.0.72, 1.0.1740 |
@GitAcc53 @linqen What you're experiencing has the same symptoms with a different underlying cause, unfortunately. It's most probably due to some of YouTube's recent changes to their site that are being released via staged roll-outs (which affect only a certain percentage of users). Will keep an eye on that, and also would appreciate any additional info you might have — including the |
I couldn't figure out how to get the info from history.state.entryTime values, problem is still happening |
I've been encountering this issue for about a year now and can confirm it still happens fairly often for me. Strangely, it's not very consistent; I can go a day or two without seeing it once, and then another day it'll happen pretty much every single time I hit the back button in Youtube. Brave Browser - v1.60.125 I was able to get the history.state.entryTime values when the issue is happening vs when it not happening, and I verified that when the issue is happening, the entryTime value does not change when pressing the back button. When the issue is not happening, the entryTime value should be smaller after pressing the back button. There were several times when I observed that this would be by an incredibly small amount (e.g. 5093.000000000022 vs 5093, or 9647.000000000022 vs 9647). I hope this helps, let me know if I can provide any extra info. Thanks! Btw @GitAcc53 and anyone else who has the issue and feels motivated to double-check, you can easily get these values by opening the dev console and typing 'console.log(history.state.entryTime);'. |
The issue is due to the incorrectness of history state. (no entry point is stored in window.history.state) That's why now the engineers trying to put The issue should be gone if you use Tabview Youtube. The related code inside Tabview Youtube: let fixHistoryStatePN = null;
if (FIX_UNCERTAIN_HISTORY_STATE) {
// history.state cannot be amended by the replaceState.
// require ytd-app.replaceState
// reason: unknown
// the history.state is also different from the isolated script's history.state
document.addEventListener("yt-navigate-start", (evt) => { // primary
const data = evt.detail;
// const entryTime = evt.timeStamp;
const entryTime = window.performance.now(); // should be mono increasing
Promise.resolve().then(() => {
if (data.pageType === 'watch' && data.reload === false && typeof data.url === 'string' && data.endpoint) {
const s = {
"endpoint": deepClone(data.endpoint),
"savedComponentState": {},
"entryTime": entryTime
}
xReplaceState(s, data.url);
console.debug('[tyt] FIX_UNCERTAIN_HISTORY_STATE for yt-navigate-start')
}
});
}, true);
fixHistoryStatePN = () => { // fallback
Promise.resolve().then(() => {
const u = `${location.pathname}${location.search}`;
let q = /^\/watch\?v=([^=?&]+)/.exec(u);
let vid = q ? q[1] : '';
if (vid && (history.state === null || ((((history || 0).state || 0).endpoint || 0).watchEndpoint || 0).videoId !== vid)) {
const s = {
"endpoint": {
"watchEndpoint": {
"videoId": vid,
"watchEndpointSupportedOnesieConfig": { // optional; object
"html5PlaybackOnesieConfig": {
}
},
"watchEndpointSupportedPrefetchConfig": {
"prefetchHintConfig": {
"prefetchPriority": 0,
"countdownUiRelativeSecondsPrefetchCondition": -3
}
}
},
"commandMetadata": {
"webCommandMetadata": {
"url": u,
"webPageType": "WEB_PAGE_TYPE_WATCH",
"rootVe": 3832
}
}
},
"savedComponentState": {},
"entryTime": window.performance.now()
};
xReplaceState(s, u);
console.debug('[tyt] FIX_UNCERTAIN_HISTORY_STATE for NULL or VideoChanged state')
}
});
};
} |
Good info! Thanks for that! |
Yes that's very helpful, thank you! I anecdotally hadn't noticed it in other browsers, but it is an intermittent issue and I use Brave far more than any other browser, so it seems reasonable that I just happened to not have encountered it on other browsers yet. Good to know it's not a Brave issue, and just a YouTube bug. |
Still not resolved. |
Hi folks - we recently made a change to our variations server which disabled the feature causing this problem (see brave/brave-variations#1224 for more info). This should be working great now. If anyone is experiencing any issues please reply back here! @Mettwasser can you please retest? (if you're still using Brave) |
I tested this out using the latest version on two different computers and could not replicate the original issue. I'm think this might be fixed! Thanks for our work! Hopefully others experience the same result. |
I was staying with brave. Can't currently test it on my main PC, but it for sure works on my laptop. So I am confident it's fixed. Thank you so, so much! |
I tested and looks like it's working! I hope so, because this issue has been around for AGES. Thank you! |
So yes, I got to test it on my main PC, and I can confirm this is resolved. Thank you for the hard work! |
Description
Steps to Reproduce
Actual result:
Previous page not loaded
Expected result:
Previous page loaded
Reproduces how often:
A few tries should be enough
Brave version (brave://version info)
Version/Channel Information:
Other Additional Information:
Miscellaneous Information:
The text was updated successfully, but these errors were encountered: