Skip to content

Instantly share code, notes, and snippets.

@aarontgrogg
Last active August 29, 2015 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarontgrogg/06406ace9b9d592bb679 to your computer and use it in GitHub Desktop.
Save aarontgrogg/06406ace9b9d592bb679 to your computer and use it in GitHub Desktop.
Create a QR Code for the current page, so it can be easily scanned by other devices.
javascript:(function(){var%20e=document.createElement("div");e.setAttribute("id","qrcode");e.setAttribute("style","box-sizing:content-box;position:fixed;top:0;left:0;z-index:99993;width:100%;height:100%;padding-top:50px;text-align:center;background-color:rgba(0,0,0,.5);box-sizing:border-box;");e.innerHTML='<img%20style="box-sizing:content-box;box-shadow:0%200%2020px%20#000;"%20src="//api.qrserver.com/v1/create-qr-code/?data='+encodeURIComponent(window.location)+'&size=500x500"%20/>'+"<div%20style=\"box-sizing:content-box;position:absolute;top:10px;right:10px;color:#fff;font-size:20px;width:20px;height:20px;line-height:20px;text-align:center;cursor:pointer;font-weight:bold;background-color:#333;padding:3px;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);transform:rotate(-45deg);border-radius:20px;border:4px%20solid%20#fff;box-shadow:0%200%2020px%20#000;\"%20onclick=\"document.getElementById('qrcode').parentNode.removeChild(document.getElementById('qrcode'));\">+";document.body.appendChild(e)})()
@aarontgrogg
Copy link
Author

Update to switch from Google Chart API (to be deprecated in 2015: https://developers.google.com/chart/terms) to goQR.me; thanks to Peter (http://www.difficultdecisions.de/) for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment