Remove the Drupal.toolbar.collapsed cookie on user logout

Created on 24 February 2017, over 7 years ago
Updated 19 April 2024, 5 months ago

For those concerned with cache and who don't want/can't modify their cache server's config (like varnish vcl).

In this case (no access to cache server config) we surely need to remove all cookies on logout and the one set by the toolbar core module isn't (Drupal.toolbar.collapsed). It is not a big deal for the user to collapse again the toolbar if not needed, so we can remove it safely on logout.

For the moment I use this simple javascript code (with jquery cookie plugin) :

if (Drupal.toolbar) {
	$('a[href*="user\/logout"]').click(function() {
		Cookies.remove('Drupal.toolbar.collapsed', {
			path : Drupal.settings.basePath
		});
	});

This could be added to the toolbar.js Drupal.toolbar.init() function.

Feature request
Status

Needs review

Version

7.0 ⚰️

Component
Toolbar 

Last updated 4 days ago

  • Maintained by
  • 🇫🇷France @nod_
Created by

🇫🇷France b.livonnen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024