Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

_NCC cookie for Bitrix (BITRIX_SM_NCC)

Browser extension that turns off the 1C-Bitrix composite cache for you: it sets the _NCC cookie (BITRIX_SM_NCC=Y) for the current site.

Firefox Add-on Firefox users

Install: Firefox Add-ons (AMO) (desktop and Android) · Chrome Web Store — coming soon

Works in Firefox 140+, Firefox for Android 142+ and Chrome / Chromium 121+ (one Manifest V3 codebase). On Android there are no keyboard shortcuts (the browser has no commands API); every browser API is checked before use, so missing APIs only switch off the related feature.

Interface languages: English, Russian, Kazakh (follows the browser language).

How it works in Bitrix

Composite site settings are stored in /bitrix/html_pages/.config.php. The cookie name is COOKIE_NCC there: the cookie prefix of the main module (option "cookie_name", BITRIX_SM by default) plus _NCC (Bitrix\Main\Composite\Helper::getOptions()).

  • A request with the cookie <prefix>_NCC=Y (exactly Y) is not served from the composite cache and the page is not saved to it (Bitrix\Main\Composite\Responder): you see the page generated by PHP, other visitors still get the cache.
  • A request with the ncc parameter (?ncc=1) is not served from the cache too.
  • Bitrix manages this cookie itself (Bitrix\Main\Composite\Engine::onEpilog()): sets it for authorized users who must not get the cache and deletes it for anonymous visitors on every page. So the extension keeps the cookie you turned on: when the site deletes it, the cookie is set again. A cookie turned off in the extension is not restored.
  • If nginx serves the composite cache directly (without PHP), its config may not check the cookie. Then use the "Open without composite (?ncc=1)" button in the popup.

Cookie name in .config.php

Popup

  • switch "Disable composite cache" — sets / removes the cookie for the current site, the toolbar icon changes its color and gets the N badge;
  • "Set cookie for" — the current host only or a parent domain with all its subdomains (e.g. .example.com for www.example.com and shop.example.com), remembered per host;
  • the cookie name is detected automatically from the site's own cookies (ARGO_GUEST_ID → ARGO_NCC) and saved for the site, unless you set a name yourself;
  • click the cookie name — own cookie name for the current site (for a site with another cookie prefix); an enabled cookie is moved to the new name; other sites keep the name from the settings;
  • "Open without composite (?ncc=1)" — reloads the current page with ?ncc=1.

Composite is on Composite is off

Keyboard shortcuts

  • Alt+Shift+Y - toggle the cookie
  • open popup - no default shortcut

Firefox: about:addons → gear → "Manage Extension Shortcuts". Chrome: chrome://extensions/shortcuts.

Options

  • cookie name (BITRIX_SM_NCC by default); the value is always Y, Bitrix checks it strictly;
  • icon colors for "on" and "off" states.

After renaming the cookie in options, cookies with the old name are removed from all sites. Settings of version 0.1 are kept (the same storage keys); the old placeholder ?????_NCC means the default name.

Installation from sources

Firefox: about:debugging#/runtime/this-firefox → "Load Temporary Add-on…" → select manifest.json. Firefox may treat host permissions as optional: if the popup shows "Grant access", click it.

Chrome: chrome://extensions → enable "Developer mode" → "Load unpacked" → select the repository folder.

Package: npm install && npm run build → web-ext-artifacts/*.zip (works for both browsers).

Development

npm install
npm run lint          # web-ext lint
npm run test:unit     # no browser: API helpers, Firefox for Android-like environment, cookie restore
npm run test:chrome   # Playwright, Chromium (CHROMIUM_PATH can point to a custom binary)
npm run test:firefox  # Selenium + geckodriver, needs Firefox
                      # (FIREFOX_PATH / GECKODRIVER_PATH can point to custom binaries)

The test server deletes the cookie the same way as Bitrix (/epilog responds with Set-Cookie: BITRIX_SM_NCC=deleted; expires=...1970...).

GitHub Actions run lint and both browser tests on every push and pull request.

Release

Bump version in manifest.json, merge to master, then push a tag with the same version:

git tag v1.0 && git push origin v1.0

The Release workflow checks the version, builds the zip and creates a GitHub release with it. Store listing texts, privacy policy and images are in store/.

Debug

All scripts log with the [NCC] prefix (enable "Debug"/"Verbose" level in the console):

  • Firefox: about:debugging#/runtime/this-firefox → this addon → "Inspect";
  • Chrome: chrome://extensions → this addon → "service worker".

Popup can be opened in a regular tab for a given tab: popup.html?tabId=N.

Files

  • common.js - shared code (cookie, settings, keeping the cookie), used by all pages;
  • background.js - icon, badge, shortcut, sync with cookie/settings changes, restoring the cookie;
  • popup.html/js/css - toolbar popup;
  • options.html/js/css - settings page;
  • _locales/ - translations (en, ru, kk);
  • tests/ - browser tests, store/ - store listing materials, screens/ - images for this README.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages