Semantic-Org/Semantic-UI · warning

$.cookie is not included. A storage solution is required.

Error message

$.cookie is not included. A storage solution is required.

What it means

Emitted by Nag's storage set()/get() (nag.js:211-212 and nag.js:230-231) when the configured storageMethod is unavailable (localStorage/sessionStorage not accessible) and the cookie fallback also fails because $.cookie === undefined. On set, nag returns without persisting; on get, the stored value is undefined. It is a console.error (nag.js:310), not thrown.

Source

Thrown at src/definitions/modules/nag.js:479

    hide : 'slide'
  },

  context       : false,
  detachable    : false,

  expires       : 30,
  domain        : false,
  path          : '/',

  // type of storage to use
  storageMethod : 'cookie',

  // value to store in dismissed localstorage/cookie
  key           : 'nag',
  value         : 'dismiss',

  error: {
    noCookieStorage : '$.cookie is not included. A storage solution is required.',
    noStorage       : 'Neither $.cookie or store is defined. A storage solution is required for storing state',
    method          : 'The method you called is not defined.'
  },

  className     : {
    bottom : 'bottom',
    fixed  : 'fixed'
  },

  selector      : {
    close : '.close.icon'
  },

  speed         : 500,
  easing        : 'easeOutQuad',

  onHide: function() {}

View on GitHub (pinned to 597843ab84)

Solutions

  1. Include the jQuery cookie plugin so $.cookie is defined.
  2. Set settings.storageMethod to a backend that is actually available in your environment.
  3. Guard localStorage access for environments (incognito/sandbox) where it throws.

Example fix

// before
$('.nag').nag({ storageMethod: 'cookie' }); // no $.cookie -> error
// after: load jquery.cookie first, OR
$('.nag').nag({ storageMethod: 'localstorage' }); // where localStorage is available
Defensive patterns

Strategy: fallback

Validate before calling

// Pick an available storage backend before initializing nag; fall back to memory.
function pickStorage(){
  try {
    if (window.localStorage) return 'localstorage';
    if (window.sessionStorage) return 'sessionstorage';
  } catch(e) { /* localStorage can throw in sandboxed/incognito */ }
  if ($.cookie !== undefined) return 'cookie';
  return null;
}
var backend = pickStorage();
if (backend) {
  $('.nag').nag({ storageMethod: backend });
} else {
  console.warn('No storage backend available; nag state will not persist.');
}

Prevention

When it happens

Trigger: settings.storageMethod:'cookie' (or a storage backend that is unavailable) while the jQuery cookie plugin is not loaded, so the fall-through at nag.js:207/227 hits the else branch.

Common situations: Removed jquery-cookie dependency, private/incognito mode blocking storage, file:// or sandboxed iframes where localStorage throws, storageMethod set to a backend the environment does not support.

Related errors


AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13). Data as JSON: /api/errors/626c1e53688649f9. Report an issue: GitHub.