I'm currently looking for a js library that can encode text in qr codes. The only one I've been able to find so far seems broken, although other people claim to be using it. The sample page doesn't work. By playing a bit with it I managed to generate codes but they don't get decoded by the phone software.
Is there another library is js for this? Has anyone managed to get it to work?
I'm not interested in a solution that pulls the code from an online service (kaywa, google etc.).
Update:
Well, you guys are right, that library does work. My problem was that I tried including it in a HTML5 Boilerplate page, and document.write doesn't seem to work in that. I modified the sample code anyway to make the browser draw in a canvas not a table and I got the order of the fillRect function backwards. Below is the corrected function call.
context.fillRect(c * UNIT_SIZE, r * UNIT_SIZE, UNIT_SIZE, UNIT_SIZE);
// it's column-row, not row-column; don't ask why :)
Since I don't get my image transposed anymore :), now the qr decodes fine. Thanks for the support.
I've found a working javascript-jquery based qrcode generator that you might be interested. Its opensource and it's really working. Here is the link: https://github.com/jeromeetienne/jquery-qrcode
The good thing about this one is that its light weight and it does not call any remote service or website.
I am using the ShieldUI Lite QR Code, which can be found here:
https://github.com/shieldui/shieldui-lite
Contains all versions of the QR Code, all Error levels.
npm has a few. I have no idea which ones are good.
Script you posted is WORKING, sample.html is not parsed as HTML.
I wrote a simple GPLv3 qr encoder in javascript that is local, uses HTML5 and is really fast as it is a port of an embedded C version I wrote for Atmel AVR processors.
http://code.google.com/p/jsqrencode/downloads/list
There is a live version (which is saveable as a webapp on iOS devices) at http://zdez.org/qrenc3.html (save to home, opens in safari so you can copy the image or use airprint)
Here is the link to the downloadable source code.
I couldn't find a javascript qr code generator.But you couldConsider using Google's API:http://code.google.com/apis/chart/docs/gallery/qr_codes.html http://togosoft.com/web/qrcode/qrcode.js
Update: I just tried http://d-project.googlecode.com/svn/trunk/misc/qrcode/js/qrcode.js and seems fine to me. The only thing I did was increase the size and made it close the TDs properly, since self closing is not correct html. http://k3rmit.org/nopaste/759 I tested 3 different strings and used a App called QRReader on my iPhone to decode.
Update 2: With
var qr = new QRCode(10, QRErrorCorrectLevel.L);
I was able to fit 271 chars in the QRCode however might not be the most reliable setting.