The examples provided in the documentation may generate errors
webpwnized opened this issue · 0 comments
webpwnized commented
The examples provided in the documentation may generate errors. Here is a working example of how to use in a browser such as Firefox. This example ensures the script does not run until after the Body has loaded since the font detector script relies on the Body element.
``
<script type="text/javascript" src="javascript/client.base.min.js">
/* Credit to https://github.com/JackSpirou/ClientJS?tab=readme-ov-file#bundles */
</script>
<script type="text/javascript">
document.addEventListener('readystatechange', event => {
// When window loaded ( external resources are loaded too- `css`,`src`, etc...)
if (event.target.readyState === "complete") {
// in a browser, when using a script tag:
const ClientJS = window.ClientJS;
// Create a new ClientJS object
const client = new ClientJS();
// Get the client's fingerprint id
const fingerprint = client.getFingerprint();
// Print the 32bit hash id to the console
console.log(fingerprint);
}
});
</script>
``