You are here: Best Practices > JavaScript and jQuery > Ensure Users Are Running Latest JavaScript

Ensure Users Are Running Latest JavaScript


What Is It?

When making JavaScript changes, ensure the changes are placed in a new filename. The current naming standard is basename_YYYYMMDD.js.

Browsers, by default, attempt to cache JavaScript and stylesheet files. As we change JavaScript to support new features, it is important that the latest JavaScript is downloaded to the users' browser. Since our users can be on their own computers, we can’t force a clearing of their browser cache.

By deploying new names for each changed JavaScript file, the browser sees these as new files and downloads them.

How Does It Work?

The header specifies a new framework file so the browser downloads it and caches the new version. The framework specifies new names for the base JavaScript files so the browser downloads those as well. The user's browser is always running your latest JavaScript code.


ClosedComponent 1: Base JavaScript Files

For each release, copy the latest base JavaScript file (commerce, config, commerce_line, homepage, and so on) into a new file with the basename + _ + RELEASEDATE.

ClosedComponent 2: JavaScript Framework

The JavaScript framework (bm-framework.js) loads all necessary JavaScript files (commerce, config, homepage, and so on). When you change one of the underlying files, you need to update the framework to pull in the correct version.

Create a new version of the framework with the naming standard bm-framework-YYYYMMDD.js.

setup.pages = {

homepage_20130323: {



commerce_20130720: {



commerce_line_20130622: {



config_20130622: {



sitewide: {




ClosedComponent 3: HTML Header

The HTML Header loads bm-framework.js. This needs to change with each release, to bring in the appropriate framework.

ClosedHow To Use It

  1. Copy latest version of base javascript file (for example, commerce_20130622.js) to a new release date
  2. Make appropriate changes.
  3. Copy the latest framework file (for example, bm-framework_20130622.js) to a new release date.
  4. Update the setup.pages section of the new bm-framework to pull in the latest base file.



Related Topics Link IconSee Also

Article Submitted by: Savvis