我试图加载fingerprintjs脚本在谷歌chrome浏览器中,Ublock起源是启用的,但这是不可能的与我目前的情况:
<script> // Initialize the agent at application startup. const fpPromise = import('https://fpcdn.io/v3/your-public-api-key')
.then(FingerprintJS => FingerprintJS.load({
endpoint: 'https://fp.yourdomain.com' }));
// When you need the visitor identifier: fpPromise .then(fp => fp.get())
.then(result => console.log(result.visitorId));
</script>
加载页面时,浏览器的控制台显示:
Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: https://fpcdn.io/v3/your-public-api-key
有人建议使用cloudflare worker来规避Ublock限制。但是我从未使用过cloudflare,我现在才开始我的第一个worker:
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
return new Response("Hello world")
}
我如何使用这个工人来获得我的visitorId
?
此功能将在几周内发布,并将成为产品的一部分。然而,有一个公开的测试版,需要一些手动步骤。如果您感兴趣,请联系官方支持:support@fingerprint.com