Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="https://raw.github.com/wbond/md5-js/master/md5.js"></script>
<script src="../src/jquery.browser-fingerprint-1.0.min.js"></script>
<script src="https://raw.github.com/jasonbarry/fontlist.js/master/fontlist.js"></script>
<script>
$(document).ready(function(){
$('#fingerprint').html($.fingerprint());
});
</script>
</head>
<body>
<p id="fingerprint"></p>
</body>
</html>
16 changes: 15 additions & 1 deletion src/jquery.browser-fingerprint-1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
p.name,p.description,
$.map( p, function(mt) { return [ mt.type, mt.suffixes ].join("~"); }).join(",")
].join("::");
}).join(";")
}).join(";"),
_fonts().join('+')
].join("###");
}

Expand All @@ -62,6 +63,19 @@
throw "md5 unavailable, please get it from http://github.com/wbond/md5-js/";
}
}

// `_fonts()` checks for the installed fonts on a system
// http://github.com/jasonbarry/fontlist.js/
function _fonts() {
if ( typeof $.fontlist === "function" ) {
// if fontlist.js is available, search for installed fonts
return $.fontlist();
}
else {
// else return empty array
return [];
}
}

// And, since I'm lazy, calling `$.fingerprint()` will return the hash
// right away, without the need for any other calls.
Expand Down
2 changes: 1 addition & 1 deletion src/jquery.browser-fingerprint-1.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.