JavaScript Coding Guidelines



By using Kintone’s “JavaScript / CSS Customization” features, the UI and features of Kintone and it’s Applications can be customized.
This page introduces guidelines for Kintone JavaScript customization that you should read before you start coding for Kintone customizations.
Please refer to our Kintone Help Pages for details on how to apply JavaScript customization to your Apps.

Coding Guidelines

Character Encoding

Always use UTF-8 without BOM.

Namespaces and Variables

Do not overwrite existing global objects.
Declare variables inside anonymous functions, and not as global variables.
Use a namespace object if a variable needs to be used between function scopes.

(function() {
  var localVariable = 1; // Good example :)
  globalVariable = 1; // Bad example :( = 'bar'; // Don't overwrite existing objects and don't add new properties
  myNameSpace = {}; // A Namespace object = 'bar';

id/class attributes that are used in Kintone

The id/class attributes of each element used in Kintone may be changed without any notice.
The DOM structure may also change without any notice.

Customization on Elements retrieved with JavaScript APIs

As Kintone’s CSS may affect the elements, they may not always look the same.
For APIs that can get elements, refer to Kintone JavaScript API.

Retrieving the URL

Use the kintone.api.url() or the kintone.api.urlForGet() method to retrieve the Kintone URL.

Effects of Kintone Updates

After Kintone has an update, there may be a possibility that the JavaScript and CSS files that you uploaded do not function correctly. In this case, please edit the file contents and re-upload them.
To greatly reduce the chance of this happening, please make sure to read through the JavaScript API documents and use the Kintone JavaScript API in your codes.

Change Policy for Public API Specifications


To prevent security issues from your JavaScript programs, please create your programs following the Secure Coding Guidelines.