Created
October 21, 2014 17:58
-
-
Save pblca/5a7e065c5e17b99e5b63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<!-- Include the QR Generator library --> | |
<script type="text/javascript" src="/static/js/vendor/qrcode.js"></script> | |
</head> | |
<body> | |
<!-- A DOM object to add the QR code to --> | |
<div id="qr"></div> | |
<script> | |
// Using the rand(x) function to get a room name | |
var roomName = rand(10); | |
//This is a little snippet for generating the 'room' name, which is just a random alphanumeric string | |
function rand(len){ | |
var text = ""; | |
var charset = "abcdefghijklmnopqrstuvwxyz0123456789"; | |
for( var i=0; i < len; i++ ) | |
text += charset.charAt(Math.floor(Math.random() * charset.length)); | |
return text; | |
} | |
//Generating a QR code to 'http://wwww.pubnub.com/m/?room=0123456789' | |
new QRCode(document.getElementById("qr"), window.location.href+"m/?room="+roomName ); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment