[Problem] Youtube Cookie gets deleted each week/Also other sites

i still have this problem, seems like some sites also get cookies deleted

i dont now if cookies have SlidingExpiration

It seems like the cookie is only created once in Youtube, when you sign in or something and then brave deletes it after 7 days. then the cookie is not created again, because Youtube thinks why create a new one, when it runs infinitely

Thanks @Saoiray, looking into this.

Figured I’d pop back in here as I now do have a simple javascript one could use for Tampermonkey as workaround to the issue. I hope it’s short and simple enough to not warrant mistrust.

// ==UserScript==
// @name         Youtube Force Theater Mode
// @version      0.1
// @description  Refresh youtube theater mode cookie for 7 days
// @match        https://www.youtube.com/watch?*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// ==/UserScript==

function setCookie(name, value, days) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate()+days);
    document.cookie = name + "=" + escape(value) + ((days==null) ? "" : ";expires="+exdate.toUTCString());
}

setCookie("wide", 1, 7);

This worked for me after a refresh or two, once to set the cookie, twice to have the cookie be used. This should reset the cookie expiration to 7 days literally every single time you open a youtube vid.
If you want to use this for a different website, just adjust the @match line in the top part, and the values as the cookie requires in the bottom setCookie line.
Though I sooner hope this problem will simply get solved.

We have a fix for this: https://github.com/brave/adblock-resources/pull/118

The issue is that YouTube sets a session cookie for wide mode. This session cookie should be cleared after a browser restart. However, Chrome doesn’t do this by default, which we think is a privacy issue and we fixed earlier this year.

However, this leads to inconsistency for cases like these between other browsers and Brave. We’ve introduced a fix for YouTube, that persists the wide session cookie in localStorage instead.

3 Likes

Nice, so its in the next Brave Update?

It should be going out over the weekend via a component update.

ok, do i need to manually add the cookie for once or when does the update come?`
it still dont work, sadly* :smiley:

You shouldn’t need to do anything. Can you try the following steps:

  1. Go to youtube.com and click on a random video.
  2. Go into theater mode.
  3. Close and restart Brave and go back to youtube.com
  4. Check if you are still in theater mode.

If you aren’t, that’s a problem. Please give the version number of your Brave Ad Block Updater component - you can find that in brave://components. Mine is 1.0.372 and it works there.

Also please make sure you’ve removed the wide cookie that you manually added for youtube.com, because that might interfere with the fix here.

i did, also it gets removed everytime i close brave:

Brave Ad Block Updater - Version: 1.0.373

Ah, it looks like your Brave Shields are turned down for youtube.com. This would prevent the fix from being inserted. Can you retry the same steps with Brave Shields turned on?

1 Like

oh, yes, it is working, but a small problem

when i start browser, it loads the tab and its not theater mode, if i press f5 it is theatermode and stays in it

That should go away after the first load. Would you mind taking a video again? That really helped debugging last time :slight_smile:

1 Like

after restart => no theater
f5 => theater

Can you try again? The fix required some fixing :slight_smile:

tested today, works great! :open_mouth:

1 Like

Great! Thanks all for the help here, super useful

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.