π Documentation Contents
π Features Overview
Everything you need for modern CAPTCHA verification
π Installation & Setup
Get started in under 2 minutes
1. Include the Script
<script src="captcha-v1.1.js" defer></script>
2. Use the Custom Component
<captcha-element></captcha-element>
π§ Challenge Types
Choose the verification method that fits your needs
Type | Description | Usage Example |
---|---|---|
visual | Standard image grid puzzle | <captcha-element type="visual"></captcha-element> |
audio | 4-digit audio verification | <captcha-element type="audio"></captcha-element> |
both | Hybrid; lets users switch modes | <captcha-element type="both"></captcha-element> |
π Dark Mode
Enable dark mode for better user experience in low-light environments:
<captcha-element type="both" dark-mode="true"></captcha-element>
π Audio CAPTCHA β Self Hosting
Critical setup information for offline environments
sounds/
folder must be placed in the same directory as captcha-v1.1.js
.
Required Audio Files Structure
sounds/ βββ 0.mp3 βββ 1.mp3 βββ 2.mp3 βββ 3.mp3 βββ 4.mp3 βββ 5.mp3 βββ 6.mp3 βββ 7.mp3 βββ 8.mp3 βββ 9.mp3
π§ Customization via Attributes
Configure your CAPTCHA with simple HTML attributes
Attribute | Description | Accepted Values | Default |
---|---|---|---|
type | Challenge type | visual, audio, both | both |
dark-mode | Enable dark mode | true, false | false |
sound-enabled | Enable sound effects | true, false | true |
β Full HTML Examples
Complete implementation examples for different use cases
πΉ Example 1: Visual Only
<captcha-element type="visual"></captcha-element>
πΉ Example 2: Audio Only
<captcha-element type="audio" dark-mode="true"></captcha-element>
πΉ Example 3: Full Hybrid Setup with Form
<form id="my-form"> <captcha-element id="captcha" type="both" dark-mode="true"></captcha-element> <br> <button type="submit">Submit</button> </form> <script> const captcha = document.getElementById('captcha'); const form = document.getElementById('my-form'); captcha.addEventListener('verified', (e) => { console.log("CAPTCHA passed!", e.detail); form.submit(); // or unlock protected actions }); form.addEventListener('submit', (e) => { if (!captcha.isValid()) { e.preventDefault(); alert("β οΈ Please complete the CAPTCHA first."); } }); </script>
π CAPTCHA Stats and Analytics
Built-in tracking for performance insights
Built-in tracking includes:
- Total attempts
- Success rate (percentage)
- Average solving time (in seconds)
- Count by difficulty level
π€ Get Analytics Data
const stats = document.querySelector('captcha-element').getAnalytics(); console.log(stats);
π Example Response
{ "totalAttempts": 5, "successRate": 80, "averageTime": 13, "difficultyCounts": { "easy": 2, "medium": 2, "hard": 1, "extreme": 0 } }
π§ͺ Programmatic Control
JavaScript API for advanced integration
β Get Status
captcha.getStatus(); // returns 'true' or 'null' captcha.isValid(); // returns true if passed
π Reset CAPTCHA
captcha.reset();
Event Triggered:
captcha.addEventListener('reset', () => { console.log("CAPTCHA reset by user"); });
π Security & Anti-Bot Features
Built-in protection against automated attacks
aCAPTCHA includes the following security features:
- DevTools detection (via viewport delta)
- Obfuscated inner HTML and injected junk nodes
- Right-click + keybinding prevention
- UI inspection protection
- Scroll-lock and element focus override
- Shadow DOM encapsulation
π§© Feature Summary
Complete overview of all included features
Feature | Included |
---|---|
Visual Grid Challenge | β |
Audio Numbers (0-9) Challenge | β |
Hybrid Switching | β |
Dark Mode Toggle | β |
Sound Effects (optional) | β |
Stats Tracking (client-side) | β |
Shadow DOM Encapsulation | β |
DevTool Detection | β |
Offline Support w/ Audio Files | β |
Fully Custom HTML Component | β |
π¬ Have Feedback?
This CAPTCHA is designed to be lightweight and modular. If you need hooks, server-side integrations, or custom challenge logicβjust reach out or fork it. we I am always looking to improve the user experience while maintaining security.