JavaScript Coding Guidelines

Overview

By using kintone's "JavaScript / CSS Customization" features, the UI and features of kintone applications can be customized.
This page introduces guidelines for kintone JavaScript customization that you should read before you start coding for kintone.
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 :(
    kintone.foo = 'bar'; // Don't overwrite existing objects
    myNameSpace = {}; // A Namespace object
    myNameSpace.foo = '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.

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 is a chance 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

Security

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

Was this article helpful?
0 out of 0 found this helpful
Comments
Please sign in to leave a comment.