Privacy API Reference
Privacy Context API
// Access the privacy context
const privacyContext = window.macroPrivacy;Properties and Methods
interface MacroPrivacyContext {
// Privacy Mode Status
isPrivacyModeEnabled: boolean; // Whether privacy mode is active
trackingProtectionLevel: TrackingProtectionLevel; // Current protection level
// Privacy Features
isFingerPrintingProtectionEnabled: boolean; // Anti-fingerprinting active
isTrackingProtectionEnabled: boolean; // Tracker blocking active
isAdBlockingEnabled: boolean; // Ad blocking active
cookiePolicy: CookiePolicy; // Current cookie policy
// Methods
getPrivacyReport(): Promise<PrivacyReport>; // Get site privacy report
requestPermission(permission: PrivacyPermission): Promise<boolean>; // Request privacy exception
}
// Types
type TrackingProtectionLevel = 'standard' | 'strict' | 'custom';
type CookiePolicy = 'accept-all' | 'block-third-party' | 'block-all' | 'ask';
type PrivacyPermission = 'storage' | 'camera' | 'microphone' | 'location' | 'notifications';
interface PrivacyReport {
trackersBlocked: number;
fingerPrintingAttemptsBlocked: number;
cookiesBlocked: number;
advertisingEntities: string[];
analyticsEntities: string[];
socialEntities: string[];
contentEntities: string[];
cryptoMiners: string[];
}Usage Example
Storage Privacy API
Ephemeral Storage
Usage Example
Anti-Fingerprinting API
Canvas Protection Example
Content Blocking API
Usage Example
Secure Communication API
Usage Example
Privacy Permissions API
Usage Example
Privacy-Aware Analytics API
Usage Example
Best Practices
Feature Detection
Progressive Enhancement
Provide Alternatives
Respect User Choices
API Availability
API
Normal Mode
Private Mode
Note
Error Handling
Conclusion
Last updated