JavaScript-Based Quick Response Code Generator Interface


314_Table_1Quick response code, or QR code in short, is a special bar code that is usually displayed as a matrix of black modules arranged in a square pattern (data codes) and used to store data in a secured manner. These patterns can be read by using QR code readers that can be downloaded on mobile phones that have a camera (for scanning the code) and a pre-activated general packet radio service (GPRS) setting. (GPRS is used to browse the Internet on mobile phones.)

Once the QR reader on the mobile phone is launched, the program activates the camera on the device. When the mobile is brought near the code and the code is focused between the black squares (three large and one small), the data gets displayed on the screen.

Fig. 1: Structure of a QR code (Image courtesy: Wikipedia, under Creative Commons Free Licence GNU GPL)

The QR code follows the Reed-Solomon error-correction algorithm and hence is less susceptible to errors as it follows parity check. The encoded information can be made up of four modes of data: numeric, alphanumeric, byte/binary and Kanji.

The QR code was first designed for the automotive industry. Now QR codes are used everywhere starting from products to webpages, advertising, mobile money transactions and goods inventories. Storing URLs, these can be found on magazines, buses and business cards. These have even found applications in Google-powered Android smart phones.

Presented here is a QR code generator interface. The software code written in JavaScript generates HTML QR codes upon feeding the data.

Table I shows how much information you can store in just one QR code symbol.

The QR code matrix depicted in the program can generate a 33×33 matrix truncated to 60 characters only. The code word so generated is 8-bit long and uses Reed-Solomon error-correcting coding technique with four levels of error correction: Level L (7 per cent), M (15 per cent), Q (25 per cent) and H (70 per cent). The percentages in brackets indicate the restoration factor. (For further details of the Reed-Solomon error-correction coding technique, visit page.)

Fig. 2: Various versions of QR codes (Images courtesy: Wikipedia)
Fig. 2: Various versions of QR codes (Images courtesy: Wikipedia)


The alphanumeric characters and their corresponding codes are given in Table II.

Fig. 1 depicts the structure of a QR code. Fig. 2 shows the various versions.


Please enter your comment!
Please enter your name here