Blog添加扫一扫功能

右侧添加了一个当前页面链接的QR码,调用Google Chart API生成,代码相当弱智:

<img id="qrcode" src="#" border="0" />
<script>
document.getElementById('qrcode').src = 'http://chart.apis.google.com/chart?cht=qr&chs=80x80&chld=|0&chl=' + encodeURI(location);
</script>

20141119:因为谷歌被墙,后来换了另一家的QR API:

document.getElementById(‘qrcode’).src = ‘https://api.qrserver.com/v1/create-qr-code/?size=80×80&data=’ + encodeURI(location);

添加这个主要是考虑到微信似乎找不到地方输入链接,必须用扫一扫才能打开浏览器,以后就可以很方便在朋友圈分享这里的链接了。

Leave a Reply

Your email address will not be published. Required fields are marked *

Using REAL email address will help you receive reply notifications.

Current ye@r *