Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The examples provided in the documentation may generate errors #161

Open
webpwnized opened this issue Jan 15, 2024 · 0 comments
Open

The examples provided in the documentation may generate errors #161

webpwnized opened this issue Jan 15, 2024 · 0 comments

Comments

@webpwnized
Copy link

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>

``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant