Install

Works with Drupal: ^8 || ^9 || ^10 || ^11

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 33.1 KB
MD5: 91c5d8fda7fa37c00d51b16776603958
SHA-1: 366e6e84f96bc2f9d2b00888b8c2236cb556e0fb
SHA-256: 81b1f8dcf3b0f44b77d8af9bf6f4734cb8dd7d196f115eba06d30492b5a80d4f
Download zip 36.9 KB
MD5: 6c6471d05cd971c69eba71ae66347060
SHA-1: c0f8674966e70773a01bf785e71e92d394adfdd2
SHA-256: 0ad80de72a43a7d94ebda532f7a636f87b92921eb2ca672d3720fe83532cf861

Release notes

A bug-fix release. Most importantly, it fixes a JavaScript error on some iOS browsers that could stop other aggregated scripts on the page from running. Updating is recommended for all 8.x-1.x users.

Bug fixes

  • Fixed TypeError: this.stristr(...).split is not a function on iOS browsers without "Version/" in the user agent (Firefox iOS, Google app). With JS aggregation enabled, this stopped other scripts in the same aggregate from running. #3595980
  • Fixed a fatal error for chained tokens such as [site:browserclass:browser] and [user:browserclass:browser]. #3595982
  • Fixed "Undefined array key" PHP warnings for some user agents (e.g. Chrome or Konqueror without a version). #3595982
  • Fixed Opera Mini version detection and versions without a dot (e.g. Version/17). #3595983

Behaviour changes

  • hook_browserclass_classes() is now invoked, as on Drupal 7. Before, it was never called on Drupal 8+. Classes from existing implementations now appear in the [browserclass:*] tokens. The body classes are built in JavaScript and are not affected. #3595982
  • Opera Mini now gets operamini<version> (e.g. operamini9) instead of operaminimini/<version>, matching the tokens. #3595983
  • Browsers whose version has no dot now get a versioned class (e.g. safari17) instead of a duplicate unversioned one. Unversioned classes such as safari and operamini are unchanged. #3595983

Other changes

  • Added GitLab CI and fixed all reported coding standards, PHPStan, ESLint and spelling issues. #3595981 #3595983
  • Rewrote js/browserclass.js. The minified file is transpiled to ES5, so it keeps working in older browsers. #3595983
  • Added a README, browserclass.api.php and an npm build script for the minified JS. #3595982 #3595983

Contributors

Thanks to therobyouknow, balis_m, GeduR, tunic and JKingsnorth for reports, patches and reviews.

Created by: norman.lol
Created on: 15 Oct 2026 at 14:40 UTC
Last updated: 15 Oct 2026 at 14:48 UTC
Bug fixes

Other releases