Saturday, June 16, 2012

Handy URL to QR Code bookmarklet.

A blog post on Carrer Blog pointed both a bookmarklet and a jQuery code snippet to convert a URL to QR code.

Here is the code used for this bookmarklet(jQuery):

$("body").append("<div id='qrcode' style='position:absolute; top:0; left:0; z-index:99993; width:550px; height:550px;background-color:#fff; padding:49px; border:1px solid #ccc'><img src='http://chart.apis.google.com/chart?cht=qr&chs=500x500&choe=UTF-8&chld=H&chl="+window.location+"' /></div>");

Or pure JavaScript code:

document.getElementsByTagName("body")[0].innerHTML="<div id='qrcode' style='position:absolute; top:0; left:0; z-index:99993; width:550px; height:550px;background-color:#fff; padding:49px; border:1px solid #ccc'><img src='http://chart.apis.google.com/chart?cht=qr&chs=500x500&choe=UTF-8&chld=H&chl="+window.location+"' /></div>"

1 comment:

  1. Wow... Thanks... I'm at the first time on your blog! And I like it! Thanks for sharing info. Keep up the good work.

    ReplyDelete

Do provide your constructive comment. I appreciate that.