Skip to content

Instantly share code, notes, and snippets.

@michaelklem
Created January 31, 2020 23:24
Show Gist options
  • Save michaelklem/b55572170868db3c70d40f7a3579e68b to your computer and use it in GitHub Desktop.
Save michaelklem/b55572170868db3c70d40f7a3579e68b to your computer and use it in GitHub Desktop.
FingerprintJS Demo
"<div id='app' class='col-md-6 col-md-offset-3'>
<h1>FingerprintJS2</h1>
<p>
<button @click='fetchFingerprint' class='btn btn-xs btn-default'>Refresh</button>
Your fp: <b>{{ fingerprint }}</b>
</p>
<table class='table'>
<tbody>
<tr v-for='component in fpComponents'>
<td>{{ component.key }}</td>
<td>{{ component.value }}</td>
</tr>
</tbody>
</table>
</div>
new Vue({
el: '#app',
data: {
fingerprint: '',
fpComponents: [],
fpOptions: {
excludeAdBlock: true
}
},
methods: {
fetchFingerprint(){
var options = {excludes:{ fonts: true, fontsFlash: true, enumerateDevices: true, pixelRatio: true, doNotTrack: true}};
Fingerprint2().get((result, components) => {
this.fingerprint = result;
this.fpComponents = components;
console.log(components); // an array of FP components
})
}
},
created(){
this.fetchFingerprint();
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.3/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.8.0/fingerprint2.min.js"></script>
table {
table-layout: fixed;
word-wrap: break-word;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment