4

I have started getting quite active on StackOverflow recently, so I've been opening fairly many links to http://jsfiddle.net, but since I'd need to resize the panels regularly to see the specific code posted in the way the code was intended, I usually end up with some pretty weird configurations for the panels. Because I would prefer not having to resize the windows to a more normal setting every time, I would like to block the window_sizes cookie from jsfiddle, but when I tried googling for how to block a single cookie from a specific site, I could find nothing.

I've also tried checking the settings for both Chrome and Firefox, but neither have the option to block a specific cookie, only to block certain domains.

I'm mostly wondering on how to block this specific cookie in Chrome (which is my default browser), but I think it might also be useful for anybody else having the same problem to also include the methods for other browsers too, if that's possible.

6
  • @techie007 oh dear, that makes me get afraid this is not possible...
    – joeytje50
    Jan 30, 2014 at 19:31
  • I agree, I'm not sure there's an answer to be had. :( Jan 30, 2014 at 19:40
  • 1
    Would editing/deleting a specific cookie be a viable workaround?
    – and31415
    Jan 30, 2014 at 22:34
  • 1
    @and31415 anything that would automatically prevent a certain cookie from being stored, accessed, or existing. If it's a small userscript, that's fine; if it's a built-in setting, that'd be great of course. I wouldn't like to have to manually delete the cookie every time I want to reset it though.
    – joeytje50
    Jan 30, 2014 at 22:36
  • @and31415 could you post the code that worked for you? I am not really able to get it to work.
    – joeytje50
    Jan 31, 2014 at 1:51

1 Answer 1

4

Achievement unlocked - Selective cookie clearing

By default, browsers don't allow such a fine-grained control over cookies: usually you can either block all third-party cookies or block all cookies for a given domain. Blocking everything is not an option because you'll easily end up breaking basic functionality (e.g. user login). In this case you have to resort to userscripts or extensions.


Firefox - userscript solution

This is the code I've come up with. Tested with Firefox 26.0, Greasemonkey 1.14.

// ==UserScript==
// @name        JSFiddlePanelReset
// @namespace   net.jsfiddle.userscripts
// @description Resets panels back to their default size whenever the site is loaded.
// @version     1.0
// @icon        http://jsfiddle.net/favicon.png
// @grant       none
// @include     http://jsfiddle.net/*
// @match       http://jsfiddle.net/*
// ==/UserScript==

(function (){

    // set the domain
    var domain = ".jsfiddle.net";

    // get a date in the past
    var expireDate = new Date(-1).toUTCString();

    // clear the size-related cookie and force it to expire
    document.cookie = "window_sizes=; domain=" + domain + "; path=/; expires=" + expireDate;

})();

Remarks

As pointed out by @Brock Adams in another question, there are major limitations on what Greasemonkey can delete:

  • The cookies you want to delete are on the current page's domain.
  • They are not "Secure cookies".
  • The cookie path (which cannot be detected by Greasemonkey) is the default path, /.
  • No cookies are set by javascript, after the page loads.
  • The thing tracking you really is a "cookie". Many websites use a variety of other techniques, including LSO's, local storage, etc.

References


Chromium-based browsers - extension

While the above userscript does clear the specified cookie, the JSFiddle panels are not reset for whatever reason. Since that's not the type of browser I use, I didn't invest too much time trying to understand why; maybe someone else can shed some light on this. As an alternative you can use the Edit This Cookie extension.

Edit This Cookie

Among other things, this particular extension can block specific cookies. You can filter them by domain, name, and value.

Blocked cookie

References

1
  • in case someone looking for a chrome extension that can select multiple cookies, provides one-click quick filters, needs to view all domain cookies of current page then check StorageAce cookie manager chrome extension.
    – CodeZila
    Jul 10, 2023 at 8:05

Not the answer you're looking for? Browse other questions tagged .