1 | <script src="https://code.jquery.com/jquery-1.10.2.js"></script> |
2 | <div id="data"></div> |
3 | <script> |
4 | function makeComputerID() { |
5 | var text = ""; |
6 | var possible = "abcdefghijklmnopqrstuvwxyz"; |
7 | |
8 | for (var i = 0; i < 12; i++) |
9 | text += possible.charAt(Math.floor(Math.random() * possible.length)); |
10 | return text; |
11 | } |
12 | |
13 | var id = localStorage.getItem('computer-id'); |
14 | $("#data").html("Computer ID: " + id); |
15 | if (id == null || id.length != 12) { |
16 | id = makeComputerID(); |
17 | localStorage.setItem('computer-id', id); |
18 | $("#data").append("<br>ID set to: " + id); |
19 | } |
20 | </script> |
Began life as a copy of #1013944
download render html show line numbers
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1013955 |
Snippet name: | Test putting computer id in localStorage |
Eternal ID of this version: | #1013955/6 |
Text MD5: | 8c6438cd1a0338f940b9af0507a8fab6 |
Author: | stefan |
Category: | javax / web |
Type: | HTML |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-03 16:47:01 |
Source code size: | 607 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 373 / 236 |
Version history: | 5 change(s) |
Referenced in: | [show references] |