Privacy API Reference

This document provides developers with detailed information about the privacy-related APIs available in Macro Browser, allowing for privacy-respecting application development while maintaining compatibility with existing web standards.

Privacy Context API


The Privacy Context API provides information about the current privacy context and allows developers to adapt their applications accordingly.

// 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


The Storage Privacy API provides mechanisms for privacy-respecting storage options.

Ephemeral Storage

Usage Example

Anti-Fingerprinting API


The Anti-Fingerprinting API allows developers to understand and work with Macro Browser's fingerprinting protections.

Canvas Protection Example

Content Blocking API


The Content Blocking API provides information about blocked content and allows for privacy-respecting fallbacks.

Usage Example

Secure Communication API


The Secure Communication API provides enhanced security and privacy for network communications.

Usage Example

Privacy Permissions API


The Privacy Permissions API allows developers to request privacy-related permissions.

Usage Example

Privacy-Aware Analytics API


The Privacy-Aware Analytics API provides a way to collect anonymous analytics while respecting user privacy.

Usage Example

Best Practices


Feature Detection

Always use feature detection instead of browser detection:

Progressive Enhancement

Design for progressive enhancement to work across all browsers:

Provide Alternatives

Always provide privacy-respecting alternatives:

Respect User Choices

Always respect user choices regarding privacy:

API Availability


Not all APIs are available in all browsing contexts:

API
Normal Mode
Private Mode
Note

Privacy Context

Always available

Ephemeral Storage

Always available

Anti-Fingerprinting

More restrictive in Private Mode

Content Blocking

More aggressive in Private Mode

Secure Communication

More restrictive in Private Mode

Privacy Permissions

⚠️

Limited in Private Mode

Privacy Analytics

Not available in Private Mode

Error Handling


Always handle errors gracefully:

Conclusion


The privacy APIs in Macro Browser enable developers to create privacy-respecting applications while maintaining compatibility with the broader web. By using these APIs properly and following the best practices, you can provide enhanced functionality specifically for Macro Browser users while ensuring a good experience for all users.

Last updated