question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Set Cookies" not working with firstparty.isolate

See original GitHub issue

I cannot get the “Set Cookies” functionality to work. I’ve tried doing the same in a fresh firefox profile and it didn’t work either. What I’m trying to achieve is to reproduce a functionality of an userscript I wrote that sets a single cookie on youtube website.

// ==UserScript==
// @name yt-dark-theme
// @namespace Violentmonkey Scripts
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
// 
function setCookie(name, value, expires, path, domain, secure){
	cookieStr = name + "=" + value + "; ";

	if(expires){
		expires = setExpiration(expires);
		cookieStr += "expires=" + expires + "; ";
	}
	if(path){
		cookieStr += "path=" + path + "; ";
	}
	if(domain){
		cookieStr += "domain=" + domain + "; ";
	}
	if(secure){
		cookieStr += "secure; ";
	}

	document.cookie = cookieStr;
}

setCookie("PREF", "f1=50000000&f6=400", false, "/", ".youtube.com", false);

Here are the settings I tried using (one of many attempts). image

I suppose I’m doing something wrong. Could You point me in the right direction? As far as I know, there’s no guide on how to use this functionality and mozilla’s cookies.set() documentation didn’t get me anywhere either.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
wjtk4444commented, Apr 29, 2019

Seems like it was the domain pattern’s fault, but I have noticed another thing. “Set Cookies” doesn’t work with privacy.firstparty.isolate set to true. Should I open a new issue? Is this even fixable?

Personally I’ve switched to using invido.us

I know about this one, but I only use youtube as a search engine and play videos in mpv instead. As long as the videos themselves are hosted on google servers I see no benefit to using it over youtube.

I use a simple Redirector

Thanks for this one, seems to react faster than my userscripts when it comes to redirections, and I do quite a few of those. Same thing goes for the “Set Cookies” functionality - youtube isn’t the only place where I’d like to use it.

0reactions
stoicallycommented, Jun 20, 2019

Whoops. There was something missing in the implementation - fixed in version 0.101.

Works for me like that:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable First-Party Isolation in Firefox - gHacks
To enable FPI, users must set “privacy.firstparty.isolate” to true by double-clicking it. The second parameter — “privacy.firstparty.isolate.
Read more >
Doesn't work with Firefox's privacy.firstparty.isolate = true #75
With privacy.firstparty.isolate = true the cookie count is always zero and cookies are not deleted despite notification claiming that they were.
Read more >
How to enable First-Party Isolation in Firefox? - Super User
1 Answer 1 · To enable FPI set privacy.firstparty.isolate to true . · If you are having problems logging into any websites due...
Read more >
How does Firefox's "first-party isolation" feature function?
From a cursory look, they isolate the cookies (and other data) on silos based on the domain you navigated to. So eg. a...
Read more >
How Different Browsers Handle First-Party and Third-Party ...
Simply go to Settings > Advanced > Site settings > Cookies and set Block third-party cookies to On. how chrome browser handles cookies...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found