Skip to content

Instantly share code, notes, and snippets.

@tvvocold
Last active May 12, 2023 09:37
Show Gist options
  • Save tvvocold/97c968d35247e5184959367baf17fc98 to your computer and use it in GitHub Desktop.
Save tvvocold/97c968d35247e5184959367baf17fc98 to your computer and use it in GitHub Desktop.
fingerprint iframe bug reproduce
<!-- so I create two local site "finger1.test" and "finger2.test" with following code -->
<!-- finger1.test/index.html -->
<script>
let fpJS;
const fpPromise = import('https://openfpcdn.io/fingerprintjs/v3').then(
(FingerprintJS) => {
fpJS = FingerprintJS;
return FingerprintJS.load();
}
);
var FID1 = null;
fpPromise
.then((fp) => fp.get())
.then((result) => {
// This is the visitor identifier:
const {
cookiesEnabled,
plugins,
screenFrame,
vendorFlavors,
hdr,
...components
} = result.components;
FID1 = fpJS.hashComponents({ ...components });
console.log('finger1 id: ' + FID1);
console.log(`finger1 components: ${JSON.stringify(result.components, null, 2)}`)
})
.catch((error) => console.error(error));
</script>
<!-- finger2.test/index.html -->
<!-- note that finger2.test has iframed finger1.test -->
<iframe src="https://finger1.test/index.html"></iframe>
<script>
let fpJS;
const fpPromise = import('https://openfpcdn.io/fingerprintjs/v3').then(
(FingerprintJS) => {
fpJS = FingerprintJS;
return FingerprintJS.load();
}
);
var FID = null;
fpPromise
.then((fp) => fp.get())
.then((result) => {
// This is the visitor identifier:
const {
cookiesEnabled,
plugins,
screenFrame,
vendorFlavors,
hdr,
...components
} = result.components;
FID2 = fpJS.hashComponents({ ...components });
console.log('finger2 id: ' + FID2);
console.log(`finger2 components: ${JSON.stringify(result.components, null, 2)}`)
})
.catch((error) => console.error(error));
</script>
<!-- then visit finger2.test, you will see two different visitorIds in the console -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment