Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: My weekend project, QR-codes for everybody (lilqr.com)
203 points by siavash on June 26, 2011 | hide | past | web | favorite | 65 comments

One problem you're probably going to run into is caches (especially caching proxies) ignoring your nocache header, causing users to see the wrong QR code.

A standard way to avoid this is by making the image URL http://lilqr.com/qr?rand=[nonce], where you'd generate the nonce randomly on each page load. You can ignore it on the server of course.

Your right, some proxies simply ignore the Cache-Control directive. In some cases even Google Chrome handles this directive poorly, as it will serve a cached version when you use the back/forward-buttons between pages no matter what cache directive you give the image. IE and FF are flawless in this regard.

Feel free to suffix the URL with a random get-varaible, as this wont affect the service more then ensuring that proxies and cache hungry browser are less likely to cache the image.

You could also add an optional GET param that allows the user to override the url for which a QR code is generated (so ?url=... would override the default functionality of detecting the url)

That parameter would also be useful and needed for https urls - browsers aren't supposed to pass those along as referrers.

This is true unless the image is served from https aswell. In that case referer is sent just as normal. I'm getting a certificate this week to serve https QRs!

I think you need a little more instruction. What does this do?

My first thought was that it would generate a QR code for any string you provide, through url hacking. (i.e anything after the domain name is used as the string to encode) - This doesn't seem to be the case.

Very little instruction on the website, nothing on twitter, and no info hereā€¦ Could you shed a little light please?

EDIT: As tiwilliam informed me, it uses the HTTP referer to create a QR code that contains a link back to that same HTTP referer. If it is not present, the default is lilqr.com.

It's a nice idea, but I don't see the value in having a QR code that links to the page you are already on? A bit more explanation is still necessary :)

Sorry, I just wanted to launch it as early as possible. Just put the img-tag on whatever page you would like to have a QR code for and it will create one to the URL of that page.

"Just paste this snippet on any page and get a QR-code to it!" made fine sense to me. nice work

Yes, but what the hell is a QR code? Hehe. Or rather, why do I want one?

I have no idea what this is used for. I'm 1/5th of the way down http://en.wikipedia.org/wiki/QR_code and still have no idea how this applies to websites. Most people who don't know aren't going to take time to go research it.

In a sentence: I have no idea what value benefit this has for me.

I'm telling you this because I want you to succeed, and if you want to gain traction outside if the HN bubble, then you'll probably want to appeal to regular people.

Same question here - What would I do with the QR code?

It would be great to have on the print version of your page.

Still, a more explicit api would be great.

link the desktop version to the mobile version

Not sure I follow... How would the QR code link the two?

If you have the webpage open on your desktop/laptop, you can easily open it on the mobile browser by scanning the QR code.

As an example, I use Evernote on my laptop and phone. I never need something like this, though, because Evernote synchronizes my data across devices. Likewise, if I want a convenient link for a long, hard-to-remember url, why not just use a url shortener?


Ah, I think I see your point now. The hypothetical website doesn't have an associated mobile app. If I'm reading the site on my laptop and want to switch to my phone, I could scan the QR code rather than typing in the url.

Great for long articles/videos with nasty urls, ...

This got me thinking -- I wish there was a browser extension that would create a QR code for whatever page I'm currently on. (Why? Because often I want to quickly open the URL on my desktop on my mobile.)

Turns out there is one -- looks pretty handy! https://chrome.google.com/webstore/detail/bcfddoencoiedfjgep...

I wish someone would create a browser extension (Rapportive, this one is for you!) that would create a QR code for contact info from a person's email signature. If I want to quickly add someone's info from an email to my phone and call them, it's so much easier to scan a QR code than to deal with Address Book and then sync my phone.

if you're running android, give chrome to phone a try. just 1 click and the site will open on your mobile without the hassle of opening a camera app to load the QR code.


This is a really great extension and works with Maps also (to load the Maps app directly). There's an extension for Opera that also utilizes the Chrome to Phone API. Not sure about Firefox.

For Firefox there's Fox To Phone.

If you use an Android phone, I would recommend using Firefox on both your phone and as your desktop browser. The latest FF builds (v4 and v5) have a sync feature which synchronizes all your history, bookmarks AND open pages in your browser. The best part about the feature is the ability to add multiple "machines" which I use to easily sync my stuff across my home computer, my work desktop and my mobile.

A very common usage scenario for me: I'm in the midst of reading a couple of webpages (most likely very heavily commented HN articles) and suddenly, I realise my train is arriving soon and I've to make a quick dash to the station. Once I get on the train, fire up FF on my phone, sync and in an instant, all my open tabs on my work computer is on my mobile.

I actually wrong a bookmarklet one day when I wanted something like this. (I don't always use the same browser.)


- or - a bookmarklet http://miniqr.com/docs/bookmarklet.php ... per default the url of the webpage you are currently viewing - or the currently selected text

Or if you want to create your own vCard


On Reddit[1], somebody posted the idea of using Prowl to push the URL quickly to an iPhone.

Hmm, that might be nice project to try out some extension programming.

[1] http://www.reddit.com/r/programming/comments/ia19p/mobile_we...

Never mind: It already exists with 2Prowl[1] for Safari. Similar extension can be found for Chrome and Firefox.

Saved me from some work. :-)

[1] http://extensions.dreamtbyphil.co.uk/

I made myself a FlagFox action which submits the current URL to Google Charts and makes a QR code out of it. Easy enough.

Clever implementation! For anyone looking to do larger/smaller/different data, the Google Charts interface works well: http://code.google.com/apis/chart/image/docs/gallery/qr_code...

Pretty cool. One downside I see of the easy way of integration (as opposed to having to use a site-specific URL) is that the browser cache cannot be used (and as expected, the image comes back with a "no-cache" header), since the browser might end up using the same image for multiple sites using the feature. Is there any caching on the server to avoid having to generate the image every time?

This is very cool, and through this thread I discovered the Google Chart API for creating QR codes. Here's my snippet that does kind of the same thing you're doing:

<img id="qrCode" /> <script type="text/javascript"> document.getElementById("qrCode").src = "https://chart.googleapis.com/chart?chs=150x150&cht=qr... + window.location + "&choe=UTF-8"; </script>

I'm going to HAVE to play with this some more. This evening my wife and I were driving around looking at houses for sale and I was thinking that every For Sale sign should have a big old QR code on it that takes you directly to a webpage for that specific house with the listing price and details about the house. I shouldn't have to jump out and grab an info sheet, I should be able to scan the big ol' QR code from my car and see the details about the house.

  use GD::Barcode::QRcode;
  my $url = 'http://news.ycombinator.com/';
  print "Content-type: image/png\r\n\r\n";
  print GD::Barcode::QRcode->new($url,{Version=>3})->plot->png;
Personally, I don't think it's a good idea to rely on third party services to do things which can be trivially performed locally.

Personally, I don't think it's a good idea to rely on third party services to do things which can be trivially performed locally.

I agree with you totally. However, there is a whole army of marketeers who can barely manage to paste some javascript into an HTML file without messing the whole thing up. Those are the folks that you can monetize off of projects like this.

BTW, it's always good to see another perlmonger.

If want to generate QR Codes locally I shared the qrcode generator I use in my Safari Extension (Tab Transmit).


Great way to jump on QR trend. Amazingly simple implementation.

Would be nice to have some way to put in the URL on a page and have it generate PNGs of different sized codes, like for printing on a brochure or poster.

I'm working on some basic customization but first up is stats for number of scans, though that would require a redirect through the service (with URL shortening ofcourse). What do you think of that?

Stats are certainly good.

Do you do any sort of detection of things like detecting that www.foo.com/bar and foo.com/bar are the same page, so they can share a code? Maybe for advanced users almost like some kind of re-write rules so that requests for/from certain pages can be linked to a static QR code?

I would also require you to create a redirect in some DB every page that a QR code had shown up on. Alternately you could just change the URL to be http://mydomain.com/subdirectory/page.html?QRCode

try http://miniqr.com/ (with API) qr codes with png, doc, pdf support

What is the poing of having a QR-code of a page in the page itself?

At Hive13, we are putting QR codes on equipment description pages using a wiki template - http://wiki.hive13.org/Equipment. Our next step is to print the template info to a sticker, which is placed on the equipment described. Then you have an easy link using your phone to further information directly on the tool itself.

I guess so you can easily jump to that page from a mobile device if it's in its camera's range.

Wow, didn't really expect hitting the front page, even less #1. Thanks for all the encouring comments! They're really motivating when you spend your spare time developing an Apache module to generate QR-codes. In 4 hours we have had 32308 generated QR codes and 5656 visitors! I intend to keep the service just as simple, but will likely add lilqr.com/qr+ for some of the more advanced features pointed out here. Once again, thanks!

three words: very very awesome

i wonder which other tools could be implemented that simple...

As with many things it has already been done I am afraid. http://www.smallqr.com/magic :-)

If it's as you suggest, and there are people that have done this previously. it would seem there was insufficient marketing. It would be interesting to hear the details of this incident and thought process.

SmallQR officially went beta only the day before I see the lilqr domain was registered so perhaps Siavash did not know about it, or perhaps he was inspired by it and thought he could do better. Either way there is a more advanced and refined service out there.

Really, really simple to implement on my site, thanks!

Absolutely brilliant! Now that is user interface! so easy to use, already added to my blog and will be adding to my business card. Thanks a lot

Any chance you could add an option to create a QR code based on a link entered? e.g. would like to create one for my Linked in page

Thanks a lot

Anyone else have an issue with this generating a url for ssl? All of mine resolve to lilqr.com. Http works fine though.

check out http://qr.linkstore.ru Just copy/paste any text and get mobile landing page as well QR-code for it

what if you simply add .qr to the short URL for the current page? You can post that link on the page if you want.

I don't understand why is it on front-page. Did you just re-invent Google Code / Kaywa API or is there something I'm missing?

javascript:document.write('<img src="http://lilqr.com/qr>)



awesome! so easy to use...

Brilliant stuff there sisvash! Grab a proper short url and you're golden.

I see QR codes really taking off this year and next.

My company uses QR code demonstrations and giveaways to get clients, this might just come in handy for us. Thank you.

ps if anyone out there is interested in selling mobile websites for us, typical commission is around $300 and you do not need to know any coding. please contact me on skype or jobs@sanfranciscomobilewebsites.com

since i see people asking how this can be useful, think about putting this on a coupon page. people are at their computer looking at the coupons before they visit a business. they simply scan the code and it brings up a mobile version with which they can use to redeem the coupon when they go to the business.

Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact