Skip to content

The examples provided in the documentation may generate errors #161

Description

@webpwnized

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>

``

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions