Getting Started
Requirements
- HTTPS: OverpoweredJS requires that your web page is served over HTTPS.
- Supported Browsers: OverpoweredJS supports all modern browsers, including Chromium-based browsers (Google Chrome, Microsoft Edge, Opera), as well as Firefox, Brave, and Safari.
Obtain an API Key
An API key is required to use the service. Login to your account or create an account if you don't already have one, then navigate to the dashboard.
You can create an API key under Config in your project.
Installation
- CDN
- NPM
page.html
<script src="https://cdn.overpoweredjs.com/opjs.min.js"></script>
terminal
npm install overpoweredjs
Basic Usage
Invoke the API by calling:
opjs({ API_KEY: 'my-api-key' }).then(fp => {
console.log(fp);
});
Example
This function retrieves the response object, which you can then send to your server or use directly in your client-side code.
Note: Running opjs()
on page load can degrade bot detection results. For effective bot detection, it is advised to load the script on page load and execute opjs()
only after the user has completed an action, such as clicking a button.
Here is a minimal example of integrating OverpoweredJS into your web page:
<!DOCTYPE html>
<html>
<head>
<title>OverpoweredJS Integration Example</title>
<script src="https://cdn.overpoweredjs.com/opjs.min.js"></script>
</head>
<body>
<button id="detectBot">Check Bot Status</button>
<script>
document.getElementById('detectBot').addEventListener('click', function () {
opjs({ API_KEY: 'my-api-key' }).then(fp => {
console.log('Fingerprint:', fp);
// Send fingerprint data to your server
fetch('/your-endpoint', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(fp),
})
.then(response => response.json())
.then(data => {
console.log('Server Response:', data);
})
.catch(error => {
console.error('Error:', error);
});
});
});
</script>
</body>
</html>