AJAX new counter

This project is not covered by Drupal’s security advisory policy.


Counter badges for anonymous users

This module adds iOS-style badges to links displaying how many new nodes (or comments or users) has been added to the page since the last time the user visited that page.

You can for example add count badges to your taxonomy links, menu items or a link to a View of the latest comments or users on your site. Badges are only added to links that the user has previously visited.

The badges are added client-side through javascript and works well with anonymous users as well as with caching and the Boost module.

This is done by storing a page visit history in the browsers javascript Local Storage, and by generating a json-file server side that contains a list of timestamps for each path that the administrator har enabled counting for. This means we don't hit the database at all on page views. It should have very low impact on performance.

Local storage is supported by IE 8+, Chrome 4+, FIrefox 3.5+ and Safari. See https://dev-test.nemikor.com/web-storage/support-test/.

The module comes with two submodules, one for taxonomy terms and one for views. A hook is provided for easy extension of supported page types. The submodules are responsible for collecting the list of timestamps for a given url. The views submodule can be used to connect any view to any url, meaning you can use it for listing new users, comments or nodes and attach that count to any link.


  • Download json2.js from https://github.com/douglascrockford/JSON-js and place it in sites/all/libraries/json2/json2.js
  • Enable the module and at least one submodule
  • Flush the menu cache if the menu posts don't show up
  • Visit the configuration page and add one or more paths to watch for news.


No requirements, but you will benefit from having publication dates on your nodes provided by Publication Date module. Otherwise this module will use the "changed" timestamp to decide which nodes are new.

Similar projects

Menu Badges - server-side generated badges.


To see it in effect, visit the page once in your browser, then add or modify an entity listed on that page, depending on how you have configured the module you might need to run cron to regenerate the history json file.


Used on https://fof.se/, visit all the header links (Toppämnen) under the logo and return in a day or two!

AJAX new counter项目的Drush安装命令:复制到剪贴板



7.x-1.0-beta3tar.gz (18.53 KB) | zip (27.68 KB)2012年11月22日发布说明简 | 繁 | 更多